Adding computers to Active Directory (AD)

Powershell cmdlet to add a computer to Active Directory

DoIT's recommended method for creating computer accounts "properly" in Campus Active Directory (CAD) is using Powershell scripting.  The CALS AD Team has created a Powershell CmdLet within the CALS ADTools Powershell Module to aid in creating computer accounts.

Overview

  • Requirements:
  • Commands will executed under a CALS T2 accounts.  This can be accomplished:
    • Use a CALS IT Jump Server (recommended).  No further setup is needed - skip to Adding a computer
    • OR Start a Powershell session with your T2 account   (Powershell 7.x is recommended, but not required)
    • OR Login to your workstation with a T2 account.

Install RSAT Active Directory

If Remote Server Administration Tools (RSAT) Active Directory has not been installed, install that first.

  1. Run Powershell as administrator

    Run powershell as administrator screenshot

  2.  Run this command:
    Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online

FIrst Time using CALS ADTools on a workstation

**this step is not needed on CALS Jump Servers**

You need to register the CALS Repository and install the CALS ADTools module. Start Powershell and run the following commands.

Register-PSRepository -Name CALSNuGet -SourceLocation "https://nuget.cals.wisc.edu" -InstallationPolicy Trusted

Install-Module -Name CALS-ADTools -Repository CALSNuGet -Scope CurrentUser

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Installation commands to install CALSNuget repository

Starting Powershell with T2 account

***this step is unnecessary if using the CALS Jump server OR if logged into workstation with T2 account***

  1. Open a Command Prompt

    Search for command prompt screenshot

  2. Type the following command.

    Using Powershell 5 (default on Windows 11)

    runas /netonly /user:ewdieckman-t2@ad.wisc.edu powershell

    Runas command to start Powershell 5

    OR Using Powershell 7.x (recommended)

    runas /netonly /user:ewdieckman-t2@ad.wisc.edu pwsh

    Runas to start Powershell 7.x

Adding A Computer

  1. Run Powershell

  2. Import the CALS ADTools Powershell module

    Import-Module CALS-ADTools

  3. Type the New-CALSComputer command

  4. Enter the computer name (i.e. CALSWK-123456)
    Ignore if you receive an error about being unable to download UnitCode.csv.   This is expected behavior on Jump Servers

  5. Select the Tier.   Tier 2 is the default.

  6. Select which Unit will house this new computer above using the number next to it.

  7. The computer account should be created in the Devices OU within the Unit that you selected.

    Screenshot of the progression of using the New-CALSComputer cmdlet

If you wish, you can script the entire command in one command.

New-CALSComputer -ComputerName CALSWK-123456 -UnitCode AAE -Description 'I am describing this computer' -Tier 2



Keywords:
active directory; computer; account; adding; add 
Doc ID:
156784
Owned by:
Eric D. in College of Agricultural & Life Sciences
Created:
2025-11-18
Updated:
2025-11-20
Sites:
College of Agricultural & Life Sciences