Newbie wants to do funky network admin things
i spent easter weekend learning powershell , regular expressions, , began it, thought, hey, can use this!
here's want do:
1. query ad computers in ou
2. parse information obtain computer names (using regex hopefully).
3. use resulting list powershell wmi queries against computers in list (-computername)
is ambitious newbie? can point me resources regarding want do?
so top half of basic ad query, returns list of directoryentries $colresults...
so, foreach de (directoryentry) in colresults array, dig in properties, , grab name... basic view of this..
$colresults | %{write-host $_.properties.name}
you'll see there no cn there , host name. last line of code how you'd use get-wmiobject pull info
$osresults = $colresults | % { gwmi win32_operatingsystem -computername $_.properties.name -erroraction silentlycontinue}
foreach (%) object in colresults wmi call (gwmi) win32_operatingsystem each computer (-computername $_.properties.name) , store in $osresults
Windows Server > Windows PowerShell
Comments
Post a Comment