Partager via


Creating a Computer Account

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to create a computer account.

Example 1

The following example demonstrates how to create a new computer, Comp1, in the OU ComputerAccounts in the Fabrikam.com domain:

New-ADComputer -SamAccountName Comp1 -Path ‘OU=ComputerAccounts,DC=FABRIKAM,DC=COM'

Example 2

The following example demonstrates how to create a new computer, Comp1, with the password p@ssword in the OU ComputerAccounts in the Fabrikam.com domain:

New-ADComputer -SamAccountName Comp1 -Path OU=ComputerAccounts,DC=FABRIKAM,DC=COM' -AccountPassword (ConvertTo-SecureString -AsPlainText 'p@assw0rd' -Force) -Enabled $true

Additional information

You can use the following parameters when you set many of the common values that are associated with creating a computer:

  • Description

  • DisplayName

  • -DNSHostName

  • -Enabled

  • -Location

  • -ManagedBy

  • -OperatingSystem

  • -OperatingSystemHotfix

  • -OperatingSystemServicePack

  • -OperatingSystemVersion

  • -ServicePrincipalNames

  • -TrustedForDelegation

For a full explanation of the parameters that you can pass to New-ADComputer, at the Active Directory module command prompt, type Get-Help New-ADComputer –detailed, and then press ENTER.