I realised there is an easier way to get the data function get-SID {
param (
[string] $computername = $env:COMPUTERNAME
)
Get-WmiObject -Class Win32_AccountSID -ComputerName $computername |
foreach {
$exp = "[wmi]'" + $( $_ . Element… Read the full text.