Friday, September 26, 2008

Free PowerShell commands for Active Directory

The good people of Quest have done it again...
On their site, you can freely download a set of predefined Windows PowerShell commands for Windows Active Directory management.
Together with a complete admin guide of 231 pages!

You can download the sources for this on the Quest site.

Here below is a sample script to create AD user accounts:

After you get it installed, you can start a regular PowerShell session and type:
Add-PSSnapIn Quest.ActiveRoles.ADManagement
This will extend the PowerShell for AD.

First we save the plaintext password as a AsSecureString:
PS C:\Users\yl.admin\Documents\PS> $pw = read-host "Enter password" -AsSecureString
Enter password: ********

Then connect to the targeted domain:
PS C:\Users\yl.admin\Documents\PS> Connect-QADService -service '' -ConnectionAccount 'xyz-stage\administrator' -ConnectionPassword $pw

Once you establish the connection to AD, you can import the csv file which has the below format:
Name Description
Svc_SP_IntrAP Intranet content web application pool
Svc_SP_IntrSSPAP Intranet farm shared services provider application pool

PS C:\Users\yl.admin\Documents\PS> import-csv C:\myworkspace\user.csv |%{new-qadUser -ParentContainer 'OU=Service Ac
ts,DC=xyz-stage,DC=com' -name $ -samAccountName $ -description $_.Description}

The accounts specified will show up in your AD.

A collection of all Administrative Templates (ADMX) for Windows Server 2008

Administrative template files in Windows Server 2008 and Windows Vista are divided into ADMX (language-neutral) and ADML (language-specific) files. ADML files are XML-based ADM language files that are stored in a language-specific folder. By default, the %Systemroot%\PolicyDefinitions folder on a local computer stores all ADMX files, and ADML files for all languages that are enabled on the computer.

Microsoft has released the beginning of this week a complete set with all ADMX Administrative templates for WS08.
The set can be downloaded here.

Administrative templates provide Group Policy setting information for the items that appear under Administrative Templates. Group Policy tools use Administrative template files to populate policy settings in the user interface. This allows administrators to manage registry-based policy settings.