About Me

My photo
HANUMANGARH, RAJASTHAN, India
Showing posts with label Get User ID from SID. Show all posts
Showing posts with label Get User ID from SID. Show all posts

Thursday, 15 September 2022

Resolve SID to user name

 Function f-sid {

param ( [Parameter(Mandatory=$true)][String]$Sid)

$objSID = New-Object System.Security.Principal.SecurityIdentifier($Sid)

Try {

($objSID.Translate( [System.Security.Principal.NTAccount])).value

}

Catch {

Write-host “`nCouldn’t find any entry matching SID : $Sid” -foregroundcolor cyan

}

}

#Put all SID in text file and run:

get-content C:\Users\su-skumar\Desktop\ser.txt | % { f-sid $_ }

Extract Disk Info from Remote host

 # Define the remote hostname or IP address $remoteHost = Get-Content "C:\temp\RemoteServer.txt" # Define the output CSV file path...