How Many computers you’re managed ?
when did you checked last time ?
are all the computers object on your directory are “alive” ?
first thing first ..
First –
load the Active Directory Module
1 |
Import-Module ActiveDirectory |
Note: Since Powershell V.3 the module of Active Directory will be loaded automatically if you’ll just enter a command from this module.
But we like to help it out.
lets store the results in a Variable Array so we can use it again … and again..
1 |
$list = Get-ADComputer -Filter 'ObjectClass -eq "Computer"' | Select Name |
now we can view the results by typing the variable $list ,and we can also can count the number of objects we got returned from the command
we ran by the “Count” option..
like $list.Count
All Together –
1 2 3 4 5 |
#Get All Computers Objects on ActiveDirectory - Import-Module ActiveDirectory $list = Get-ADComputer -Filter 'ObjectClass -eq "Computer"' | Select Name $list |
Related Post: Test-Connection
(Visited 269 times, 1 visits today)