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 automate it for a large number of users.
Windows PowerShell Cmdlets
This release includes four Windows 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 Windows PowerShell best practices and they provide detailed help and examples.
The Windows PowerShell cmdlets can be executed from computers running Windows® 7, Windows Server® 2008 R2, Windows® 8 and Windows Server® 2012.
The Active Directory Windows PowerShell Module needs to be installed.
Please follow the steps below to install the PrimaryComputer Windows PowerShell module.
Install the Active Directory Windows PowerShell module following the instructions
Unblock the PrimaryComputer.zip file if necessary.
Start Windows Explorer, and locate the saved zip file.
Right-click on the zip file, and then click Properties.
Click Unblock (If you do not see the Unblock button, then the file is already unblocked)
Extract the PrimaryComputer.zip file to a folder called PrimaryComputer. (
Please retain the folder name specified in the example
Copy the PrimaryComputer folder to $Home\Documents\WindowsPowerShell\Modules.
Set the Windows PowerShell execution policy to RemoteSigned. More information is availble
Launch Windows PowerShell and execute Import-Module PrimaryComputer
On Windows® 7, Windows Server® 2008 R2, you will have to import the Active Directory Windows PowerShell module using Import-Module ActiveDirectory before this step.
You are ready to use the Windows PowerShell cmdlets
To get a list of cmdlets, execute Get-Command -Module PrimaryComputer in your Windows PowerShell window after you have successfully loaded the module.
To get the detailed help for a particular cmdlet, execute Get-Help Get-XADPrimaryComputer -Full. (
Replace Get-XADPrimaryComputer with the name of the cmdlet that you are interested in.
Additional information on Primary Computer can be found in the following locations:
Deploy Primary Computers for Folder Redirection and Roaming User Profiles
Configuring Primary Computers
Information on Windows PowerShell cmdlets for Active Directory can be found here:
Active Directory Administration with Windows Powershell
Jun 13 2013 at 10:24 PM
, version 24
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.