Get SID or GUID information of Domain Computers and Export to CSV

The user account you are running this powersell command must have local admin rights on the computers. The computer you are using must have Active Directory Module installed. If you need to install AD Module, you can check this article.

Create a txt file with the computers name (no title). I named this file as servers.txt

Then run this powershell command on Powershell ISE


$servers = Get-Content "c:\servers.txt"
$Outputfile = foreach ($server in $servers) {
Get-ADComputer -Filter 'name -eq $server' -Properties sid | select name, sid
$Outputfile | Export-Csv -Path "c:\myexport.csv"


If you replace sid with ObjectGUID, you can have a list of GUIDs of computer objects.

You can get many different properties by using the same method. For the possible properties please check the link below:


  • Hits: 542