Posted in
Windows Powershell,
Windows Server |
1 Comment | 5,676 views | 09/10/2009 12:59
Do you need to see LDAP paths of your all computers in Active Directory?
1
2
3
4
5
6
7
8
| $Searcher = New-Object DirectoryServices.DirectorySearcher([ADSI]"")
$Searcher.Filter = "(objectClass=computer)"
$Computers = ($Searcher.Findall())
Foreach ($Computer in $Computers)
{
$Path=$Computer.Path
write-host $Path
} |
$Searcher = New-Object DirectoryServices.DirectorySearcher([ADSI]"")
$Searcher.Filter = "(objectClass=computer)"
$Computers = ($Searcher.Findall())
Foreach ($Computer in $Computers)
{
$Path=$Computer.Path
write-host $Path
}
LDAP names can save your life :) You can use LDAP names in your Powershell scripts to manage your computers.