Skip to content

Instantly share code, notes, and snippets.

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

George Sp5rky

🏠
Working from home
View GitHub Profile
@Sp5rky
Sp5rky / wingetinstall.ps1
Created October 7, 2023 00:32
Winget Installation
# Fetch the URI of the latest version of the winget-cli from GitHub releases
$latestWingetMsixBundleUri = $(Invoke-RestMethod https://api.github.com/repos/microsoft/winget-cli/releases/latest).assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') }
# Extract the name of the .msixbundle file from the URI
$latestWingetMsixBundle = $latestWingetMsixBundleUri.Split('/')[-1]
# Show a progress message for the first download step
Write-Progress -Activity 'Installing Winget CLI' -Status 'Downloading Step 1 of 2'
# Temporarily set the ProgressPreference variable to SilentlyContinue to suppress progress bars
@Sp5rky
Sp5rky / licenseguidtodisplay.ps1
Created October 6, 2023 03:08
Resolve MSFT License GUID -> Display Name
Connect-AzAccount
#74658136-14ec-4630-ad9b-26e160ff0fc6 is the AppId to https://main.iam.ad.ext.azure.com/api/AccountSkus?backfillTenants=false
$Token = (Get-AzAccessToken -ResourceUrl "74658136-14ec-4630-ad9b-26e160ff0fc6").Token | ConvertTo-SecureString -AsPlainText -Force
$webData = Invoke-WebRequest -UseBasicParsing -Uri "https://main.iam.ad.ext.azure.com/api/AccountSkus?backfillTenants=false" `
-Headers @{
"Authorization"="Bearer $([PSCredential]::new("token", $($script:Token)).GetNetworkCredential().Password)"
}
@Sp5rky
Sp5rky / Passwordgenerator.ps1
Created March 14, 2023 22:37
Generates a password from wordlist
#Generate a random password from a list of words and a special character
# Get the list of words from a URL
$url = 'https://gist.githubusercontent.com/Sp5rky/8d3b36dad42a2a71dd142ca80f481484/raw/5356681469364a377b506c57c03ac6dedc17be7c/gistfile1.txt'
$content = Invoke-WebRequest -Uri $url | Select-Object -ExpandProperty Content
$lines = $content -split "`n"
# Pick two random words from the list
$randomLine1 = $lines | Get-Random
$randomLine2 = $lines | Get-Random
# Define a string of special characters
$specialChars = '!', '@', '#', '$', '*', '%'