Skip to content

Instantly share code, notes, and snippets.

View JordanTheITGuy's full-sized avatar
🏠
Working from home

Jordan Benzing JordanTheITGuy

🏠
Working from home
View GitHub Profile
$tenantId = '' ### Paste your tenant ID here
$appId = '' ### Paste your Application ID here
$appSecret = '' ### Paste your Application secret here
#NOTE: Build the auth response token to the Windows Security Center API (Basically establishing a logged in session)
$resourceAppIdUri = 'https://api.securitycenter.windows.com'
$oAuthUri = "https://login.windows.net/$TenantId/oauth2/token"
$authBody = [Ordered] @{
resource = "$resourceAppIdUri"
client_id = "$appId"
@JordanTheITGuy
JordanTheITGuy / Get-NeededPorts.ps1
Last active January 19, 2023 15:05
Determine the ports you need for Patch My PC - Based on results from the Scan tool wizard.
#Download the current network allow list from the internet.
curl https://patchmypc.com/scupcatalog/downloads/PatchMyPC-DomainList.csv -o PMPC-CurrentAllowList.csv
#import the data from the CSV
$domainList = Import-Csv -Path '.\PMPC-CurrentAllowList.csv'
#Import and store the scan results from the patch MY PC publisher
$scanResults = Import-Csv -Path '.\PatchMyPC-1_19_2023-6_23 AM.csv'
#Calculate the results...
$results = $domainList | Where-Object {$_.Product -in $scanResults.Product}
#Export to new CSV list.
$results | Export-Csv -Path .\PMPC-TrimmedNetworkList.csv -Encoding utf8 -NoTypeInformation
@JordanTheITGuy
JordanTheITGuy / get-standardtimes.ps1
Created August 30, 2022 19:09
Get the current time in a bunch of time zones. Or don't. Bonus points send them all to Markdown and round to the nearest second.
function Get-StandardTimes {
<#
.Description
The Get-StandardTimes function is designed to get a bundle of standardized times from various time zones you care about.
To update the list of time zones you care about update the array of time zones with the results from "Get-TimeZone".
.EXAMPLE
Get-StandardTimes
@JordanTheITGuy
JordanTheITGuy / ProjectVulnerabilities.KQL
Created September 2, 2021 16:59
Merge Device Vulnerability Data with uh
DeviceTvmSoftwareVulnerabilities
| join DeviceInfo on DeviceId, $left.DeviceId == $right.DeviceId
| project DeviceName,OSPlatform,OSVersion,OSArchitecture,SoftwareName,SoftwareVendor,SoftwareVersion,CveId,RecommendedSecurityUpdate,RecommendedSecurityUpdateId,LoggedOnUsers
@JordanTheITGuy
JordanTheITGuy / Get-UpdateNamefromCIID.ps1
Created August 31, 2021 21:22
Find an Update based on CI ID in Configuration Manager
#Sometimes your ADR will fail to download content for a specific update ID, and all you have is rule engine. Sometimes SQL is too bothersome, so here is powershell
#To take the update ID and get the name of the udpate that is failing.
#GLHF
#Enter the site code here instead
$siteCode = "XYZ"
#Enter the CI ID
$ciID = "11111111"
Get-CimInstance -ClassName SMS_SoftwareUpdate -Namespace "root\SMS\site_$($SiteCode)" -Filter "CI_ID = $($ciID)" | Select-Object LocalizedDisplayName,DateCreated
@JordanTheITGuy
JordanTheITGuy / new-sugmerging.ps1
Last active April 12, 2021 21:17
merge sugs in an ugly way
$SUGFormat = "Patch My*"
$updates = Get-CMSoftwareUpdateGroup -LocalizedDisplayName $SUGFormat | Select-object -ExpandProperty updates
New-CMSoftwareUpdateGroup -Name "Example Merged SUG" -UpdateID $updates
@JordanTheITGuy
JordanTheITGuy / invoke-spongebob.ps1
Created July 29, 2020 13:46
SpongeBob Random silliness
function Invoke-Spongebob {
[cmdletbinding()]
param(
[Parameter(HelpMessage = "provide string" , Mandatory = $true)]
[string]$Message
)
$charArray = $Message.ToCharArray()
foreach ($char in $charArray) {
$Var = $(Get-Random) % 2