Here's the PowerShell script to search for computers in the domain control and report the details you've requested:
# Define the domain name $domain = "yourdomain.com" # Get all computers in the domain $computers = Get-ADComputer -Filter * -Properties IPv4Address, Description | Select-Object Name, IPv4Address, Description # Loop through each computer and gather the details foreach ($computer in $computers) { # Get the MAC address $macAddress = (Get-WmiObject win32_networkadapterconfiguration -ComputerName $computer.Name | Where-Object {$_.IPEnabled -eq $true}).MACAddress # Get the SID $sid = (Get-WmiObject win32_useraccount -ComputerName $computer.Name | Where-Object {$_.SID -match "S-1-5-21"}).SID # Get the computer type based on the description field if ($computer.Description -match "laptop") { $computerType = "Laptop" } elseif ($computer.Description -match "desktop") { $computerType = "Desktop" } elseif ($computer.Description -match "virtual machine") { $computerType = "Virtual Machine" } elseif ($computer.Description -match "docker unit") { $computerType = "Docker Unit" } elseif ($computer.Description -match "mac") { $computerType = "Mac" } elseif ($computer.Description -match "iphone") { $computerType = "iPhone" } elseif ($computer.Description -match "linux") { $computerType = "Linux" } elseif ($computer.Description -match "unix") { $computerType = "Unix" } else { $computerType = "Other" } # Output the details to the console Write-Host "Computer Name:" $computer.Name Write-Host "IP Address:" $computer.IPv4Address Write-Host "MAC Address:" $macAddress Write-Host "SID:" $sid Write-Host "Type:" $computerType Write-Host "" }
This script defines the domain name and gets all computers in the domain. It then loops through each computer and gathers the details you requested. The script determines the computer type based on the description field of the computer object. Finally, the script outputs the details to the console. You can modify the script to output the details to a file or another destination if desired.