View aws-ssm-param.ps1
<# | |
.SYNOPSIS | |
Helper script to manage SSM parameters | |
.PARAMETER name | |
SSM key name to set | |
.PARAMETER value | |
SSM key value to set |
View keepaliveScheduler.ps1
<# | |
.SYNOPSIS | |
Keeps you productive by spoofing activity to prevent GPO idle timeouts, RDP disconnects, sleep, etc. | |
.Description | |
This script creates a Scheduled Task that runs at login which uses Kernel SetThreadExecutionState to prevent GPOs | |
from disconnecting your RDP session. Will also prevent sleeping/screensavers/display timeouts | |
See the example below for a one liner that will download and execute this script directly from GitHub! |
View rdp-keepalive.ps1
$host.ui.RawUI.WindowTitle = "Idle Keepalive" | |
$dotNetCode = @' | |
[DllImport("kernel32.dll", CharSet = CharSet.Auto,SetLastError = true)] | |
public static extern void SetThreadExecutionState(uint esFlags); | |
'@ | |
$ste = Add-Type -memberDefinition $dotNetCode -name System -namespace Win32 -passThru | |
$ES_CONTINUOUS = [uint32]"0x80000000" #Requests that the other EXECUTION_STATE flags set remain in effect until SetThreadExecutionState is called again with the ES_CONTINUOUS flag set and one of the other EXECUTION_STATE flags cleared. | |
$ES_AWAYMODE_REQUIRED = [uint32]"0x00000040" #Requests Away Mode to be enabled. |
View isLocked.ps1
[bool]$isLocked = (Get-ADUser 'username' -Properties LockedOut).LockedOut | |
if ($isLocked -eq $True) { | |
Write-Host "Account is locked" | |
} else { | |
Write-Host "Account is not locked" | |
} |
View github-auth.ps1
$headers = @{'Accept' = 'application/json'} | |
$tokenString = "REPLACE-GITHUB-TOKEN-HERE" + ":x-oauth-basic" | |
$base64Auth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(($tokenString))) | |
$headers.Add('Authorization',"Basic $base64Auth") | |
$content = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/ORG/Repo/master/something.ps1" -Headers $headers |
View pause-locally.ps1
#Add to end of script | |
if ($PSSenderInfo) { | |
#Script was launched remotely. Do Not Pause | |
} | |
else { | |
#Script is running locally, pause | |
[void](Read-Host 'Press Enter to continue') | |
} |
View zoom_mute_global_hotkey.ahk
^m:: | |
IfWinExist, ahk_class ZPContentViewWndClass | |
WinActivate | |
Send, !a | |
Exit | |
IfWinExist, ahk_class ZPFloatVideoWndClass | |
WinActivate | |
Send, !a |
View fizzbuzz.ps1
for ($x = 1; $x -le 100; $x++) { | |
$Output = "" | |
if ($x % 3 -eq 0) { $Output += "Fizz" } | |
if ($x % 5 -eq 0) { $Output += "Buzz" } | |
if ($Output -eq "") { $Output = $x } | |
Write-Output $Output | |
} |
View isLocked.ps1
[bool]$isLocked = (Get-ADUser 'username' -Properties LockedOut).LockedOut | |
if ($isLocked -eq $True) { | |
Write-Host "Account is locked" | |
} else { | |
Write-Host "Account is not locked" | |
} |
View sendmail.ps1
$message = new-object Net.Mail.MailMessage; | |
$message.From = "YourName@gmail.com"; | |
$message.To.Add('dev07-promotional@booker.local'); | |
$message.Subject = "Test by Joe"; | |
$message.Body = "Message body here"; | |
$smtp = new-object Net.Mail.SmtpClient("smtp.server.local", "25"); | |
$smtp.send($message); |
NewerOlder