This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import uuid | |
from pathlib import Path | |
from urllib.parse import urlparse | |
from datetime import datetime | |
import html2text | |
import requests | |
from bs4 import BeautifulSoup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory=$true)] [string] $WhereClause, | |
[Parameter(Mandatory=$true)] [string] $ExportFilename, | |
[switch] $ForceExport | |
) | |
# Load ODBC utility functions | |
. $PSScriptRoot\odbc_utils.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CredsConnString() { | |
[OutputType([hashtable])] | |
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory=$true)][PSCredential] $Credential | |
) | |
$PlainCred = [ordered] @{ | |
UID = $Credential.UserName | |
PWD = [PSCredential]::new(0, $Credential.Password).GetNetworkCredential().Password | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory)][System.IO.DirectoryInfo]$SourceFolder, | |
[Parameter(Mandatory)][string]$RemoteFolder, | |
[Parameter(Mandatory)][string]$Server, | |
[Parameter(Mandatory)][pscredential]$Credential | |
) | |
function New-TemporaryDirectory { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Send-CustomMail { | |
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory)][string[]]$To, | |
[Parameter(Mandatory)][string]$Subject, | |
[Parameter(Mandatory)][string]$Body, | |
[string]$SMTPServer = 'SMTP.ACME.LOCAL', | |
[string]$From = 'support@acme.local', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Module ExchangeOnlineManagement | |
#Requires -Module BurntToast | |
$UPN = 'john.appleseed@apple.com' | |
$DateFormatCulture = [CultureInfo]'en-GB' | |
# This has to be at the top, before the calendar, to avoid the 'single thread apartment' error | |
Write-Host 'Connecting to Exchange Online...' | |
Connect-ExchangeOnline -UserPrincipalName $UPN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-ADUser() { | |
[CmdletBinding()] | |
<# | |
Perform a user account lookup on a given DC and return a boolean | |
indicating success or failure. | |
#> | |
param( | |
[string]$UserName, | |
[string]$Server | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Module BurntToast | |
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory)][string]$ComputerName, | |
[Parameter(Mandatory)][string]$ConnectionID | |
) | |
function Test-TCPPort { | |
# Replacement for Test-NetConnection, because ping cannot be disabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import sys | |
def get_content(url): | |
r = requests.get(url) | |
r.raise_for_status() | |
return r.text |
NewerOlder