Skip to content

Instantly share code, notes, and snippets.

View Ethanb00's full-sized avatar

Ethan Bennett Ethanb00

View GitHub Profile
@Ethanb00
Ethanb00 / expiringExpiredPassword.ps1
Created September 30, 2022 17:13
Script to List Expired and Expiring Active Directory Passwords (90 days forward)
$maxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge.Days
$AdUsers = Get-ADUser -Filter {accountExpires -ne $false -and PasswordneverExpires -eq $false -and Enabled -eq $true} -Properties * | sort -Property name
foreach ($i in $AdUsers){
$LastSet = $i.PasswordLastSet
$ExDate = $LastSet.addDays($maxPasswordAge)
if($ExDate -lt (Get-Date).AddDays(90) -and $ExDate -ge (Get-Date) ){
$passExpireSoon = $passExpireSoon + $i.name + ", $ExDate`n"
}elseif($ExDate -lt (Get-Date)){
@Ethanb00
Ethanb00 / Automating Message Labels Based on The Sender For A Delegated Gmail Account
Created April 16, 2020 14:47
Gmail/Gsuite provides no native way to filter on the basis of which user sent an email within a delegated gmail account. That filter is required to be able to automatically apply labels and organize the inbox (in order to easily and quickly see who sent which emails). This sample code block outlines how to parse through your sent box and filter …
function processInbox() {
//var threads = GmailApp.search("in:sent", 0, 500); //you can uncomment this line to run a bulk labelling the first time thru, then recomment it for the future
var threads = GmailApp.search("newer_than:2h"); //check for new messages in the past x time frame, you can adjust this as needed
for (var i = 0; i < threads.length; i++) { //interate thru all the threads we found
var sentBy = threads[i].getMessages()[0].getHeader("X-Google-Sender-Delegation") //isolate the header value "X-Google-Sender-Delegation" - This is the email header that indicates which user actually sent the email thru the delegated account
if (sentBy == "[email protected]"){ //if the message is sent by this email address - this is the unfortunate part. you have to hard code each email that you are expecting to see. so you're going to make 1 or more if statements related to each of the labels that you created in the delegated email account to capture these messages
var label = GmailApp.getUserL
<style>
button{
padding: 20px;
margin: 20px;
}
</style>
<div style="margin:0 auto; width:75%; text-align:center;">
<h3>I need to fill out the attorney referral request form in: <br>
Necesito completar el formulario de solicitud de referencia de abogado en:</h3>
<button id=trigger-english href="#">English</button>
@Ethanb00
Ethanb00 / Remove Chrome Preference That Makes PC's Vulnerable to Zoom Exploit
Last active July 9, 2019 18:55
For PC only. Open Chrome. Open Powershell. Copy and Paste, Run. Does NOT need to run as admin.
get-process -name Chrome | stop-process; $badstring1 = '"zoommtg":false'; $badstring2 = "zoomrc:false"; cd $env:userprofile"\AppData\Local\Google\Chrome\User Data\Default"; Set-Content -Path .\Preferences -Value (get-content -Path .\Preferences | Select-String -Pattern $badstring1 -NotMatch); Set-Content -Path .\Preferences -Value (get-content -Path .\Preferences | Select-String -Pattern $badstring2 -NotMatch)