Renaming and domain joining via PowerShell

Every server that you build will need a hostname set, and most likely will need to be joined to your domain. We are all familiar with doing these things with the mouse using System properties, but have you ever thought of using a command interface to do these tasks quickly? Let's work together to discover how PowerShell can once again help make these necessary tasks more efficient.

Getting ready

We have just finished turning on a new Windows Server 2012 R2 machine. Immediately following the mini-setup wizard in order to get logged into Windows, let's now use PowerShell to set our hostname and join the system to our domain.

How to do it...

Follow these steps to rename and domain join this new server with PowerShell: ...

Get Windows Server 2012 R2 Administrator Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.