Skip to content

Instantly share code, notes, and snippets.

View scriptingstudio's full-sized avatar
👍
Awake and ready

Matthew Gray scriptingstudio

👍
Awake and ready
View GitHub Profile
@scriptingstudio
scriptingstudio / getuseragent.ps1
Created November 16, 2026 16:59
A PowerShell script to fetch a list of the latest and most common useragents seen on the web across all device types, operating systems, and browsers
param (
[switch] $cache,
[switch] $latest
)
if ($cache -and $global:useragentcache) {
$response = $global:useragentcache
} else {
$response = Invoke-RestMethod https://www.useragents.me/api -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36' -TimeoutSec 18
if (-not $response) {
@scriptingstudio
scriptingstudio / msi-info.ps1
Created November 21, 2026 07:52
A simple way to get properties from MSI/MSP installers
<#
.SYNOPSIS
MSI/MSP properites
.LINK
https://learn.microsoft.com/en-us/windows/win32/msi/summary-property-descriptions
.NOTES
There are 2 ways to get properites from MSI/MSP installers:
- database
Cons: extremely slow
- SummaryInformation method
@scriptingstudio
scriptingstudio / get-localipaddress.ps1
Last active November 27, 2026 10:03
The fastest way to know your local IP address
function get-localipaddress ([switch]$ipV6, [switch]$all) {
if ($all) {
return (get-localipaddress),(get-localipaddress -ipV6)
}
if ($PSVersionTable.PSEdition -eq 'core') {
$p = if ($ipV6) {@{ipv6=$true}} else {@{ipv4=$true}}
(Test-Connection $env:computername -count 1 @p).DisplayAddress
} else {
$p = if ($ipV6) {'IPV6Address'} else {'IPV4Address'}
(Test-Connection $env:computername -count 1).$p.IPAddressToString
@scriptingstudio
scriptingstudio / Get-AppxProvisionedPackageOnline.ps1
Last active December 2, 2026 11:14
A simple work around that don't require admin privileges
function Get-AppxProvisionedPackageOnline ([string[]]$name) {
$sbstr = if ($name) {
($name | ForEach-Object {"`$_.PSChildName -like '$_'"}) -join ' -or '
} else {'$_'}
$filter = [scriptblock]::Create($sbstr)
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications' |
Where-Object $filter | ForEach-Object {
$p = $_ | Get-ItemProperty
$displayName, $version, $arch, $resourceId, $pub = $_.PSChildName -split '_'
[PSCustomObject]@{
@scriptingstudio
scriptingstudio / Get-CimClassMember.psm1
Last active December 4, 2026 10:38
GCCM - "get-member" for CIM/WMI classes
<#
.SYNOPSIS
GCCM - "get-member" for CIM/WMI classes.
.DESCRIPTION
Get information about CIM/WMI class members.
Key features:
- Get-Member output style for class summary (default mode)
- Method and property details
- Remote operations
- Listing of classes in the namespace selected