Skip to content

Instantly share code, notes, and snippets.

@Unskilled
Unskilled / ConvertFromSID.ps1
Created May 14, 2017 16:11 — forked from mattifestation/ConvertFromSID.ps1
Example of filtering off the Win32_AccountSID association class to convert a SID->User using only WMI
function ConvertFrom-SID {
param (
[Parameter(Position = 0, Mandatory = $True)]
[String]
[ValidateNotNullOrEmpty()]
$SID
)
$AccountSIDInstance = Get-CimInstance -ClassName Win32_AccountSID -Filter "Setting = 'Win32_SID.SID=`"$SID`"'"