Search Wiki:


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 primary 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.

Powershell Cmdlets

This release includes four powershell cmdlets and these are:
  1. Get-XADPrimaryComputer : Retrieves the list of primary computers for a user from Active Directory
  2. Get-XADPrimaryUser : Retrieves the list of primary users for a computer from Active Directory
  3. Add-XADPrimaryComputer : Adds a computer to the list of primary computers for a user in Active Directory
  4. 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 here


  • 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 Unblock-File Powershell cmdlet.
  • Extract the 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 PSModulePath
  • 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
Last edited May 23 2012 at 10:04 PM  by MUTHUS_MSFT, version 6
Page view tracker