MSDN Archive Home
Help and FAQs
All Resource Updates
Change History (all pages)
With Primary Computers feature in Windows 8, administrators can limit the Folder Redirection and Roaming User Profiles technologies to be applied only to a set of
computers for the users. This association of primary computers for a given user is established in a linked attribute in Active Directory called ms-DS-PrimaryComputer. Manipulating this list through the ADAC (Active Directory Administrative Console) can become error-prone, and cumbersome if administrators are doing it on a regular basis for more than a few users. The scripts below are intended to ease the process of establishing the primary computer relationship for users and even automate it for a large number of users.
This release includes four powershell cmdlets and these are:
Get-XADPrimaryComputer : Retrieves the list of primary computers for a user from Active Directory
Get-XADPrimaryUser : Retrieves the list of primary users for a computer from Active Directory
Add-XADPrimaryComputer : Adds a computer to the list of primary computers for a user in Active Directory
Remove-XADPrimaryComputer : Removes a computer from the list of primary computers for a user in Active Directory
These cmdlets have been developed using all the Powershell best practices and they provide detailed help and examples.
The Powershell cmdlets can be executed from computers running Windows® 7, Windows Server® 2008 R2, Windows® 8 and Windows Server® 2012. You will have to make sure that the Active Directory Powershell modules are installed properly by referring to the Installation section
Depending how you downloaded the zip file, you might have to unblock it before extracting it. You can do this thru the Windows Explorer or using the
Extract the PrimaryComputer.zip file to a folder called PrimaryComputer. (
Please retain the folder name specified in the example
Copy the PrimaryComputer folder to any of the directories in
Launch Powershell and execute Import-Module PrimaryComputer
You will have to import the Active Directory powershell module using Import-Module ActiveDirectory before, if you are running from Windows 7 / Windows Server 2008 R2 based computer.
You are ready to use the powershell cmdlets
To get a list of cmdlets, execute Get-Command -Module PrimaryComputer in your powershell window after you have successfully loaded the module.
Additional information on Primary Computer can be found here:
Configuring Primary Computers
Information on Powershell cmdlets for Active Directory can be found here:
Active Directory Administration with Windows Powershell
May 23 2012 at 10:04 PM
, version 6
Sign in to add a comment
Wed May 23 2012 at 7:00 AM
More Tags ...
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.