Instantly share code, notes, and snippets.

View vscode_ps_snippets
"Help": {
"prefix": "help",
"body": [
"<#",
".SYNOPSIS",
"\tShort description",
".DESCRIPTION",
"\tLong description",
".EXAMPLE",
"\tC:\\PS>",
View Win10_1809_RSAT
# Set variables
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\"
$name = "UseWUServer"
$value = "0"
$service = "wuauserv"
# Reset variables
$resetValue = Get-ItemPropertyValue -Name $name -Path $registryPath
# Set reg value and restart service
View vs_code_extensions
aws-scripting-guy.cform
ban.spellright
bceskavich.theme-dracula-at-night
DanielThielking.aws-cloudformation-yaml
DavidAnson.vscode-markdownlint
DotJoshJohnson.xml
dracula-theme.theme-dracula
eamodio.gitlens
emilast.LogFileHighlighter
kddejong.vscode-cfn-lint
View vscode_settings
{
"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
"powershell.powerShellExePath": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
"powershell.startAutomatically": true,
"powershell.scriptAnalysis.enable": true,
"powershell.integratedConsole.focusConsoleOnExecute": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
View AWS_PS_Notes
Install-Module AWSPowerShell.NetCore
Install-Module AWSLambdaPSCore
$accessKey = "YourAccessKey"
$secretKey = "YourSecretKey"
$awsc = New-AWSCredential -AccessKey $accessKey -SecretKey $secretKey
Get-AWSRegion
$region = "YourRegion"
Get-EC2Instance -Credential $awsc -Region $$region
$Instances = (Get-EC2Instance).instances
View PoshGram_Functions
#import the PoshGram module
Import-Module -Name "PoshGram"
#--------------------------------------------------------------------------
#easy way to validate your Bot token is functional
Test-BotToken -BotToken $botToken
#--------------------------------------------------------------------------
#send a basic Text Message
Send-TelegramTextMessage -BotToken $botToken -ChatID $chat -Message "Hello"
#--------------------------------------------------------------------------
#send a photo message from a local source
View get-filename
<#
.Synopsis
Returns file name from full file path
.DESCRIPTION
Takes a fully provided path to a file and returns just the file name of that path
.EXAMPLE
Get-FileName -FilePath C:\afolder\afile.txt
Returns just the filename from the fully provided path
.EXAMPLE
View ps_multipart_form
#Author: Jake Morrison - @jakemorrison - http://techthoughts.info/
#Contributor: Mark Kraus - @markekraus - from his post on PowerShell and Multipart/form-data - https://get-powershellblog.blogspot.com/2017/09/multipartform-data-support-for-invoke.html
#note: this was tested in PowerShell 6.0.2
try {
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$stringHeader.Name = "chat_id"
$StringContent = [System.Net.Http.StringContent]::new("$ChatID")
$StringContent.Headers.ContentDisposition = $stringHeader
View Send-TelegramTextMessage
<#
.Synopsis
Sends Telegram text message via Bot API
.DESCRIPTION
Uses Telegram Bot API to send text message to specified Telegram chat. Several options can be specified to adjust message parameters.
.EXAMPLE
$bot = "#########:xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx"
$chat = "-#########"
Send-TelegramTextMessage -BotToken $bot -ChatID $chat -Message "Hello"
.EXAMPLE
View zip_module_dsc_azure
#used for zipping up custom dsc resources prior to upload to Azure automation
#--------------------------------------------------------------------------------
#install the required xPSDesiredStateConfiguration module if you haven't already:
#Install-Module xPSDesiredStateConfiguration
#--------------------------------------------------------------------------------
#import the module
Import-Module xPSDesiredStateConfiguration
#--------------------------------------------------------------------------------
#create the module .zip for Azure uploading
Publish-ModuleToPullServer -Name xNetworking -OutputFolderPath C:\DSC\Uploads `