Rename & join a computer into a domain within a single powershell command

This command renames the local computer to and then restarts automatically.

In my Test environment the command would be  alike:

Rename-Computer -NewName “w2016DC2” -DomainCredential test.test\administrator -Restart

which translates into:

Rename-Computer -NewName “desired_name” -DomainCredential “domain\username”-Restart

Modify the following parameters:

 “w2016DC2” (your desired computer name)

test.test\administrator ( AD account needed )

Domain admin credentials or either an account with the sufficient permissions-delegation.

This will be displayed once done, following a computer restart.

2018-01-09 20_30_03-W2016DC2 on 2016CORE - Virtual Machine Connection.png

once the credentials are introduced, will be in our domain after the restart.

2018-01-09 20_34_15-W2016DC1 on 2016CORE - Virtual Machine Connection.png

All of the parameter inputs

Rename-Computer
[-ComputerName ]
[-PassThru]
[-DomainCredential ]
[-LocalCredential ]
[-NewName]
[-Force]
[-Restart]
[-WsmanAuthentication ]
[-Protocol ]
[-WhatIf]
[-Confirm]
[]

a quick reference TechNet guide

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/rename-computer?view=powershell-5.1

 

Advertisement

One thought on “Rename & join a computer into a domain within a single powershell command

  1. The article title indicates there´s a domain join involed, the commandlet only shows instructions on how to rename a workstation already joined to a domain. The screenshots also shows DC01 as a machine name which is not the name used for the rename command. This article is severaly lacking and unclear and needs rework.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.