qad* commands:
You'll need to download the free PowerShell Commands for Active Directory from http://www.quest.com/
Exchange commands:
You may need to install the Exchange Management tools from the Exchange ISO and then run Add-PSSnapin microsoft.exchange.management.powershell.e2010#get home dir paths
foreach
($user in get-content usernames.txt)
{get-qaduser -identity $user | select
homedirectory
}
#set home dir paths
foreach ($user in get-content usernames.txt)
{set-qaduser -identity $user -homedirectory "<UNC
Home Dir Path>"
}
# Set AD company attribute and AD extension attribute #2
foreach
($user in get-content usernames.txt)
{set-qaduser -identity $user -company "<Company
Name>" -objectAttributes @{extensionAttribute2="<text>"}
}
#Set AD user attributes
foreach ($user
in get-content usernames.txt)
{
get-qaduser -identity $user | select
cn,creationdate,city,NTAccountName
}
#Set UPN
foreach
($user in get-content usernames.txt)
{set-qaduser -identity $user
-userprincipalname $user@<new domain.com>
}
#Get AD user attributes
foreach ($user in get-content usernames.txt)
{get-qaduser -identity $user
-includeallproperties | select PrimarySMTPAddress,email,PrimarySMTPAddressSuffix,UserPrincipalName,sn,FirstName,LastName,logonName,displayname,StateOrProvince,city }
#Get AD computer attributes and save to .csv file
Add-PSSnapIn
-Name Quest.ActiveRoles.Admanagement
get-qadcomputer
* -sizelimit 0 -includeallproperties | select
Name,ComputerName,cn,description,whenCreated,whenChanged,operatingSystem,operatingSystemServicePack,dNSHostName,ComputerRole,DnsName,DN,Type,parentcontainer,managedby,extensionattribute15
| Export-Csv "D:\temp\AllADComputerObjects.csv"
remove-item <Old File Path>
copy-item “D:\temp\AllADComputerObjects.csv”
<New Path>
#Get all email addresses for all objects
Add-PSSnapin
microsoft.exchange.management.powershell.e2010
get-mailbox
* -resultsize unlimited -domaincontroller <Domain Controller> | select
SamAccountName -expand EmailAddresses | Export-Csv <outpot.csv>