Computer Property Viewer Powershell Example

This Powershell script will locate every computer object in the target OU and build a sortable/filterable grid view of the object properties.

[powershell] # ComputerPropGrid.ps1
#
#
$Computers = @()
$OU = “OU=Staff,OU=COEDEAN,OU=COE” # Change to target OU
$query = [ADSISearcher]””
$query.Filter = “objectClass=Computer”
$query.SearchRoot = “LDAP://” + $OU + “,OU=NCSU,DC=wolftech,DC=ad,DC=ncsu,DC=edu”
$Results = $query.FindAll()
$Results | ForEach-Object{
$objItem = $_.Properties
$obj = New-Object PSObject
foreach($name in $objItem.PropertyNames | Sort) {
Add-Member -in $obj -Type NoteProperty -Name $name -Value $objItem[$name] }
$Computers += $obj
}
$Computers | out-gridview
[/powershell]