Skip to content

Instantly share code, notes, and snippets.

@ericjaystevens
Created May 20, 2016 12:53
Show Gist options
  • Save ericjaystevens/ac65dc7495c5b54da7bfca9aa2a94eee to your computer and use it in GitHub Desktop.
Save ericjaystevens/ac65dc7495c5b54da7bfca9aa2a94eee to your computer and use it in GitHub Desktop.
Get information about all the Windows desktop computers in your environment that are connected to your Windows update server and export it to a csv
#requires PoshWSUS
Import-Module PoshWSUS
$wsusServer = read-host -promt "enter WSUS server name"
Connect-PSWSUSServer $wsusServer -Port 80
$pcs = Get-PSWSUSClient | Where-Object { -not ( $_.osdescription -like "Windows Server*" )}
foreach ($pc in $pcs) {
$pc | Add-Member -notepropertyname department -NotePropertyValue $($pc.requestedTargetGroupNames | select -First 1)
}
$pcs | select fulldomainName,make,model,osdescription,department | Export-Csv computerInventoryInfo.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment