# Managing Azure Functions via PowerShell Cmdlets
# Prerequisites:
# - PowerShell Core 6 or greater --> https://github.com/PowerShell/PowerShell/releases
# - Core Tools --> https://github.com/Azure/azure-functions-core-tools#installing
# - Az.Functions preview module --> https://www.powershellgallery.com/packages/Az.Functions/0.0.2-preview
# Install Azure Functions PowerShell core module
Install-Module -Name Az.Functions -AllowPrerelease
This file contains hidden or 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
| Get-Command # Retrieves a list of all the commands available to PowerShell | |
| # (native binaries in $env:PATH + cmdlets / functions from PowerShell modules) | |
| Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft* | |
| Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item" | |
| Get-Help # Get all help topics | |
| Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page) | |
| Get-Help -Name Get-Command # Get help for a specific PowerShell function | |
| Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command |
This file contains hidden or 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 -Version 7 | |
| # Version 1.2.13 | |
| # check if newer version | |
| $gistUrl = "https://api.github.com/gists/a208d2bd924691bae7ec7904cab0bd8e" | |
| $latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version') | |
| $versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)" | |
| if ([System.IO.File]::Exists($latestVersionFile)) { |
This file contains hidden or 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 ConvertTo-Object { | |
| param( | |
| [Parameter(Mandatory=$true,ValueFromPipeline=$true)] | |
| [AllowEmptyString()] | |
| [string[]]$InputString, | |
| [Parameter(Mandatory=$true,ValueFromRemainingArguments=$true)] | |
| [string[]]$Pattern | |
| ) |
This file contains hidden or 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 -version 5.0 | |
| Function ConvertTo-Markdown { | |
| <# | |
| .Synopsis | |
| Convert pipeline output to a markdown document. | |
| .Description | |
| This command is designed to accept pipelined output and create a markdown document. The pipeline output will formatted as a text block. You can optionally define a title, content to appear before the output and content to appear after the output. | |
| The command does not create a text file. You need to pipe results from this command to a cmdlet like Out-File or Set-Content. See examples. | |
| .Parameter Title |
This file contains hidden or 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 ConvertTo-Base64KMSEncryptedString { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter( | |
| Mandatory = $true, | |
| ValueFromPipeline = $true | |
| )] | |
| [String[]] | |
| $String, |
This file contains hidden or 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 Update-CodePSExePath { | |
| $version=$PSVersionTable.PSVersion.Major | |
| if($version -eq 5) { | |
| $powerShellExePath = (get-command powershell.exe).Source | |
| } else { | |
| $powerShellExePath = (get-command pwsh.exe).Source | |
| } | |
| $settingsFile = "$env:APPDATA\Code\User\settings.json" |
When using a USG with Ubiquiti's Unifi Controller software (version 5.6 and earlier), the functionality of integrating the hostnames of clients (when they request a DHCP lease) into local DNS does not appear to work as you would find with Consumer grade routers. To work around this limitation, we can add static host mappings to a configuration file that will be provisioned to the USG when either a configuration change is made or we force provisioning to the USG itself.
I've added in the necessary syntax for adding Cloudflare DDNS to the USG for VPN/Services setup courtesy of this post by britannic on the Ubiquiti Forums.
This file contains hidden or 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
| # .SYNOPSIS | |
| # Print a tree given a key property and parent property | |
| # | |
| # .PARAMETER InputObject | |
| # | |
| # The object to print. | |
| # | |
| # .PARAMETER KeyProperty |
This file contains hidden or 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
| # Based on a script from Mike F. Robbins | https://twitter.com/mikefrobbins | |
| # http://mikefrobbins.com/2017/05/18/use-powershell-to-determine-if-specific-windows-updates-are-installed-on-remote-servers/ | |
| # Customized by Paul G. Fitzgerald | https://twitter.com/pgfitzgerald | |
| $Timestamp = Get-Date -Format "yyyyMMdd-HHmmss" | |
| $Computers = Get-ADComputer -Filter * | |
| # Adjust ThrottleLimit as needed | |
| Invoke-Command -ComputerName ($Computers | Select-Object -ExpandProperty Name) -ThrottleLimit 32 -ScriptBlock { | |
| $Patches = 'KB4012598', # Windows XP, Windows Vista, Windows 8, Windows Server 2003 |