Andrei published on PowerGUI.org a bunch of how-to’s to Active Directory management with PowerShell:
- A quick intro to the Management Shell for AD from Quest Software
- AD Tricks: How many objects do you have in your AD, part 1
- AD Tricks: How many objects do you have in your AD, part 2
In these posts Andrei shares some of his tips and tricks for using free Active Directory cmdlets to manage your AD environment.
Among the scenarios he covers are:
- Enumerating users, groups and other objects
- List all users in my domain
- List all users in a specific OU
- Get help on Get-QADUser parameters
- Get specific user properties
- List first-level organizational units in your domain
- List all users in my domain with their display name and city
- Find all users in my domain that has City attribute starts with ‘ny’
- Updating user properties
- Set description for a specific user account:
- Set city to Liverpool for all user accounts in the Demo OU
- User creation
- Create user accounts
- Group operations
- Create a new group
- Add all users with a specific description to a group
- List group members, display names and descriptions
- Bulk creation
- Export useraccounts to a CSV file
- Import useraccounts from a CSV file
- Import useraccounts from CSV file and add them to a specific group
- Statistics:
- Count users, groups, OUs
- Count departments
- Get statistics for departments, locations, etc.
- Count mailboxes per each mailbox store (will work against Exchange 2000 and Exchange 2003)
Note that all of them are one-liners! Managing Active Directory from command line has never been so easy.
源文档 <http://dmitrysotnikov.wordpress.com/2007/04/18/powershell-for-active-directory-examples/>