Using Powershell to build a list of computer model numbers in our Domain? -
as title states, trying determine every computer model used in our domain. new company, , have been placed in charge of producing new encryption solution end point devices. knowing computer models in our domain, able determine machines have tpm 1.2 chip, , ones don't (almost 15k devices). not need pretty, i'm open ideas. more or less want list (text or csv sorting purposes) can quantify models , research.
here's have far:
get-adcomputer -filter {name -like 'ml*'} | select -expand name | foreach { if (test-connection $_ -count 1 -quiet) {get-wmiobject -class win32_computersystem -computername $_} select-object -property model | export-csv "c:\scripts\models.csv"} else { add-content -value $_ c:\scripts\not.responding.txt}
i know there problems this. right i'm having trouble querying ad , passing computer name variable only. because of this, ping test fails, , exports failed text file. failed text file indicates variable includes lot more computer name. if can pull variable correctly, i'm not sure if rest work, think should. appreciated.
$computernames = get-adcomputer -filter {name -like 'ml*'} | select -expand name foreach ($computername in $computernames){ if (test-connection $computername -count 1 -quiet){ get-wmiobject -class win32_computersystem -computername $computername | select-object -property model | export-csv "c:\scripts\models.csv" } else{ add-content -value $computername c:\scripts\not.responding.txt } }
there go.
Comments
Post a Comment