General Command
$PSVersionTable
Server 2008 AD
- Allow remote access to powershell
cmdlet: enable-remoting -force
- To access AD powershell from member computer of an AD use(can be remote or locally):
cmdlet: import-module ActiveDirectory
- To list all AD users
cmdlet: get-aduser -server <computername> -filter *
-To sort by specific property. Sort must be define after -filter command otherwise not working.
cmdlet: get-aduser -filter * | sort -property <properties>
e.g: get-aduser -filter * | sort -property name / samaccountname / DisplayName
-To display without header
cmdlet: get-aduser -filter * | select samaccountname -ExpandProperty samaccountname
-To display without header and with custom string “absb\"
cmdlet: get-aduser -filter * | -expandproperty samaccountname | foreach{ "absb\" + $_.samaccountname }
-To select only specific property
cmdlet: get-user -filter * | select samaccountname / DislayName / Name
-To call a specific user
cmdlet: get-aduser -identity <userid>
shortcut: get-aduser <userid>