Skip to content

Instantly share code, notes, and snippets.


Joe Cefoli jcefoli

View GitHub Profile
jcefoli / isLocked.ps1
Created Aug 2, 2020
Check if domain user is locked out
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"
jcefoli / github-auth.ps1
Created Aug 2, 2020
Authenticate with token to Download File from Raw Githubusercontent
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 "" -Headers $headers
jcefoli / pause-locally.ps1
Created Feb 4, 2020
Pause Script When Run Locally But not Remotely
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')
jcefoli / zoom_mute_global_hotkey.ahk
Last active Nov 4, 2019
[AutoHotKey] Set Ctrl-M Global Hotkey to Mute/Unmute Zoom Calls
View zoom_mute_global_hotkey.ahk
IfWinExist, ahk_class ZPContentViewWndClass
Send, !a
IfWinExist, ahk_class ZPFloatVideoWndClass
Send, !a
jcefoli / fizzbuzz.ps1
Created Oct 24, 2019
[Powershell Interview Question] The FizzBuzz Problem: Write a program that prints the numbers 1 to 100. For multiples of 3, print "Fizz". For multiples of 5, print "Buzz". FOr multiples of both 3 and 5, print "FizzBuzz".
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
jcefoli / isLocked.ps1
Created Oct 15, 2019
Conditionally Check for AD Locked Out User Account
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"
jcefoli / sendmail.ps1
Created Oct 14, 2019
Send Email in Powershell via .NET Net.Mail.SmtpClient & Net.Mail.MailMessage
View sendmail.ps1
$message = new-object Net.Mail.MailMessage;
$message.From = "";
$message.Subject = "Test by Joe";
$message.Body = "Message body here";
$smtp = new-object Net.Mail.SmtpClient("smtp.server.local", "25");
jcefoli / kickjenkins.ps1
Created Sep 24, 2019
Kick Jenkins Job With CSRF Protection Enabled [Powershell REST Request]
View kickjenkins.ps1
# Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Basic Auth Credentials
$user = 'changeme'
$pass = 'insecure-password'
# Handle Basic Auth (Hacky in Powershell)
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))

Keybase proof

I hereby claim:

  • I am jcefoli on github.
  • I am jcefoli ( on keybase.
  • I have a public key whose fingerprint is 1EEF B0D8 3F20 F83B 086B 888C CE34 4425 E18C 50B4

To claim this, I am signing this object:

jcefoli / Disable-AeroShake.ps1
Created Sep 3, 2019
Disable Aero Shake (Idiotic Windows feature that minimizes all windows if you shake one window with the mouse. I do this when I'm thinking sometimes inadvertently and it annoys the hell out of me)
View Disable-AeroShake.ps1
#Run as Admin
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisallowShaking" -Value "0" -PropertyType "DWord"
You can’t perform that action at this time.