Skip to content

Instantly share code, notes, and snippets.

I make stuff (up)

Sean O'Sullivan seanosullivanuk

I make stuff (up)
View GitHub Profile
seanosullivanuk / log4jscanner-batchscript.bat
Created Dec 21, 2021
Qualys Log4JScanner, PDQ Deploy script
View log4jscanner-batchscript.bat
:: This is a script I've set up in PDQ Deploy. Be sure to run this as administrator.
:: Also, not my best work... but it does work.
:: Replace servername and hiddenshare$ with your own UNC path info
copy "\\servername\hiddenshare$\Log4JResults\Log4jScanner.exe" "%userprofile%\AppData\Roaming\Log4jScanner.exe"
"%userprofile%\AppData\Roaming\Log4jScanner.exe" > "\\servername\hiddenshare$\Log4JResults\Results\%host%.txt"
del "%userprofile%\AppData\Roaming\Log4jScanner.exe"
seanosullivanuk / rdusersessions.ps1
Created May 10, 2021
Export CSV of existing RDS User Sessions
View rdusersessions.ps1
Get-RDUserSession -ConnectionBroker "" | Export-Csv -Path c:\temp\connections.csv -NoTypeInformation
seanosullivanuk / ShareandNTFS.ps1
Created Dec 12, 2020
Create a folder, add a hidden share, set NTFS permissions and disable inheritance
View ShareandNTFS.ps1
#Install-Module -Name NTFSSecurity
$user = "test.user"
$domain = "contoso"
# Create the folder and share it
New-Item -Path D:\Employees\$user -ItemType directory
New-SmbShare -Name "$user$" -Path "D:\Employees\$user" -ChangeAccess "$domain\$user"
# Set file permissions (change to taste)
seanosullivanuk / DisableEXCHIMAPPop.ps1
Created Dec 3, 2020
Exchange Online - Disable IMAP and POP for current and future mailboxes
View DisableEXCHIMAPPop.ps1
#Turn off IMAP and POP for future mailboxes
Get-CASMailboxPlan -Filter {ImapEnabled -eq "true" -or PopEnabled -eq "true" } | set-CASMailboxPlan -PopEnabled $false
#Turn it off on all existing mailboxes
Get-CASMailbox -Filter {ImapEnabled -eq "true" -or PopEnabled -eq "true" } | Select-Object @{n = "Identity"; e = {$_.primarysmtpaddress}} | Set-CASMailbox -ImapEnabled $false -PopEnabled $false
seanosullivanuk / AZObjectID.ps1
Last active Dec 1, 2020
Get the Azure AD ObjectID of a specific UPN
View AZObjectID.ps1
Get-AzureADUser -ObjectId ""
seanosullivanuk / ADAccountsWOInheritance.ps1
Created Nov 17, 2020
List all Active Directory user accounts that have their security inheritance disabled
View ADAccountsWOInheritance.ps1
Get-ADUser -SearchBase "OU=Users,DC=internal,DC=example,DC=co,DC=uk" -Filter * -Properties nTSecurityDescriptor | ?{ $_.nTSecurityDescriptor.AreAccessRulesProtected -eq "True" }
seanosullivanuk / calperm.ps1
Created Oct 15, 2020
Manage Calendar permissions on an Exchange Online mailbox
View calperm.ps1
# View the existing Calendar permissions on the Break Room mailbox
Get-MailboxFolderPermission -Identity\Calendar
# Add John Smith to the Break Room mailbox's calendar, as Reviewer
Add-MailboxFolderPermission -Identity\Calendar -User -AccessRights Reviewer
# You can change existing access to the Break Room calendar, with the Set commandlet
Set-MailboxFolderPermission -Identity\Calendar -User -AccessRights Editor
# When you are done, use the Remove commandlet
seanosullivanuk / changeIcon.js
Created Oct 11, 2020
Changing the icon within a Chromium extension, depending upon the OS' dark mode status
View changeIcon.js
// Functions to change the app icon depending upon light or dark mode
function updateIconLightMode() {
path : {
"32": "assets/appicons/32.png",
"24": "assets/appicons/24.png",
"16": "assets/appicons/16.png"
seanosullivanuk / exportaduseraccountscsv.ps1
Created Oct 2, 2020
Export a list of Active Directory user accounts to a CSV, grabbing specific properties.
View exportaduseraccountscsv.ps1
Get-ADUser -Filter 'title -ne 0' -Properties givenName,sn,title,mail,sAMAccountName |select-object givenName,sn,title,mail,sAMAccountName | convertto-csv -Delimiter "`t" -NoTypeInformation | Select-Object -Skip 1 | % { $_ -replace '"', ""} | out-file "EmployeeExport.csv" -fo -en ascii
seanosullivanuk / customdomaindkim.ps1
Created Sep 26, 2020
Enable DKIM on a custom domain, with Microsoft 365 Exchange Online
View customdomaindkim.ps1
# First, create a new DKIM Signing config for your custom domain
New-DkimSigningConfig -DomainName -Enabled $true
# Next, output the necessary CNAME records you need to create
Get-DkimSigningConfig -Identity | Format-List Selector1CNAME, Selector2CNAME
# Once the CNAME records are in your DNS, enable DKIM signing