Search Wiki:

Introduction

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

Requirements

  • The PowerShell cmdlets can be executed from computers running Windows® 7, Windows Server® 2008 R2, Windows® 8 and Windows Server® 2012.
  • The Active Directory PowerShell Module needs to be installed.

Installation

Please follow the steps below to install the PrimaryComputer PowerShell module.
  1. Install the Active Directory PowerShell module following the instructions here
  2. Unblock the PrimaryComputer.zip file if necessary.
    1. Start Windows Explorer, and locate the saved zip file.
    2. Right-click on the zip file, and then click Properties.
    3. Click Unblock (If you do not see the Unblock button, then the file is already unblocked)
  3. Extract the PrimaryComputer.zip file to a folder called PrimaryComputer. (Please retain the folder name specified in the example)
  4. Copy the PrimaryComputer folder to one of the directories in PSModulePath.
  5. Set the PowerShell execution policy to RemoteSigned. More information is availble here.
  6. Launch PowerShell and execute Import-Module PrimaryComputer
    1. On Windows® 7, Windows Server® 2008 R2, you will have to import the Active Directory powershell module using Import-Module ActiveDirectory before this step.
  7. 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.
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.)

Resources

Additional information on Primary Computer can be found in the following locations:

Information on PowerShell cmdlets for Active Directory can be found here: Active Directory Administration with Windows Powershell
Last edited Sep 24 2012 at 8:35 PM  by MUTHUS_MSFT, version 22
Updating...
Page view tracker