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

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL