3000xtra
adobe
adsi
adsi management
alias
arguments
automation
bcp
bloomberg
bootable usb
bulk copy program
cacls
check patch
citrix
citrix dazzle
citrix mfcom
citrix printing errors
citrix xenapp
citrix xenapp 5.0
cmdlet reference
color
command
command-line
directx
disk information
domain groups
domain membership
driver
drivers
enumerate
error handling
event id 26
event log
example
export
flex
how to
ica
icon
import
install printer
jet
mfcom
microsoft virtual pc
powershell
printer
printers
reciever
reuters
server 2008
sign
sql
stick figure
summary database
terminal server
terminal services
vbscript
Windows 7
wmi
xenapp
adsi management |
Managing Directory Services
Our recommendation is that if you have VBScripts to manage Active Directory using ADSI, continue to use them.
If your directory service management needs are simple, say you want to be able to find users, you can actually use WMI and the Get-Wmiobject cmdlet to query Active Directory:
#GetLDAPUsers.ps1
$user=read-host "What user credentials do you want to use for" `
"authentication to the" `n `
"domain controller? Use format domain\username."
$cred=get-credential $user
$server=read-host "What domain controller do you want to connect to?"
$rc=read-host "Do you also want to save output to a text file? [YN]"
if ($rc -eq "Y") {
$file=read-host "Enter the filename and path"
write-host "Connecting to" $server "as" $user
get-wmiobject -class ds_user -namespace root\directory\ldap `
-computername $server -credential $cred | `
select-object DS_Name,DS_distinguishedname,DS_sAMAccountname |`
tee-object -file $file
}
else
{
write-host "Connecting to" $server "as" $user
get-wmiobject -class ds_user -namespace root\directory\ldap `
-computername $server -credential $cred | `
select-object DS_Name,DS_distinguishedname,DS_sAMAccountname
}


