PowerShell – ActiveDirectory Searches

Cool stuff. Get every AD User Object that has an E-mail message attribute assigned:

Import-Module ActiveDirectory
Get-ADObject -Filter {(mail -like "*") -and (ObjectClass -eq "user")} -Server CORP:3268


Import-Module ActiveDirectory
Get-ADObject -Filter {(mail -like "*") -and (ObjectClass -eq "user")} -Server CORP:3268


Import-Module ActiveDirectory
Get-ADUser -Filter {(SamAccountName -like "*" -and (mailNickName -like "*")} `
| Set-ADUser -Replace @{extensionAttribute1='FoundAttribute1';extensionAttribute2='FoundAttribute2';}

Reference URLs:
http://technet.microsoft.com/en-us/library/ee617198.aspx
http://technet.microsoft.com/en-us/library/dd772723(WS.10).aspx

Extra:

Get-Command -Module *
Get-Command -Module CimCmdlets
Get-Command -Module ActiveDirectory

Advertisements

PowerShell – Active Directory – Server Core Stuffs

Configure a Server Core Server: http://technet.microsoft.com/en-us/library/jj592692.aspx
(Also, there is “SCONFIG.CMD” when you first login to a Server Core installation that can be used.)

Install a New Windows Server 2012 Active Directory forest: http://technet.microsoft.com/en-us/library/jj574166.aspx
Import-Module ActiveDirectory
Get-ADForest domain.com | Format-Table SchemaMaster,DomainNamingMaster
Get-ADDomain domain.com | Format-Table PDCEmulator,RIDMaster,InfrastructureMaster Reference: http://support.microsoft.com/kb/223346

Turning the GUI on/off with either SCONFIG or PowerShell:
http://www.howtogeek.com/111967/how-to-turn-the-gui-off-and-on-in-windows-server-2012/