🧬 WQL / PowerShell
Win32_TimeZone: Finding Associated Objects (WQL ASSOCIATORS OF)
Demonstrates Get-CimAssociatedInstance, the modern CIM equivalent of WQL's ASSOCIATORS OF syntax, against a Win32_TimeZone instance.
TimeZoneAssociators.ps1
<#
.SYNOPSIS
WQL/CIM reference: objects associated with a Win32_TimeZone instance.
.DESCRIPTION
The classic WQL "ASSOCIATORS OF" syntax has a modern, simpler CIM
equivalent: Get-CimAssociatedInstance. Pass it any CIM instance and
it returns every object related to it through any association class
— useful for walking relationships between WMI objects.
.EXAMPLE
.\TimeZoneAssociators.ps1
#>
[CmdletBinding()]
param()
$instance = Get-CimInstance -ClassName Win32_TimeZone | Select-Object -First 1
if (-not $instance) {
Write-Warning "No Win32_TimeZone instances found to look up associations for."
return
}
Write-Host "Objects associated with this Win32_TimeZone instance:" -ForegroundColor DarkGray
Get-CimAssociatedInstance -InputObject $instance | Format-Table -AutoSize