Techtip: Change name using Powershell

In Windows Server 2012, you can do most, if not all administrative tasks using Powershell. There are roughly 2400 comdlets letting you manipulate the system in every unholy way imaginable! One of those ways is to change the computer name.

To change the computer name, simply run the following two lines:

You can for example use this code to script renaming multiple computers in bulk, or just to avoid cluttering up your screen with a GUI.

 

 

Change LastWriteTime (Date Modified) on files

So here’s a little nugget that might help you at the end of backup sessions, or in my case, to adjust for the time zone difference on my vacation after forgetting to check my cameras clock for the entire 2 week duration. Despite it’s simplicity, this script is in fact quite powerful, and if used towards the wrong folder, or with the wrong scope (Get-Childitem -recurse) it can cause a bit of damage.

A fun thing about this script is that by changing the time parameter, you can actually put the Date Modified field into the future without changing the clock on your computer.

 

 

 

 

 

Autodeploy one or more servers without System Center

I use this script to deploy one or more identical servers in Hyper-V. The script handles both the use of a Golden Image template .VHDX file, or a clean installation using an ISO install image and will provide you with a question by question gathering of the most common installation parameters.

Prerequisites:

  • Windows Server 2012 release candidate or above
  • Powershell 3.0
  • Hyper-V role installed on the server
  • Hyper-V Powershell module installed on the server
  • A template VHDX file for each operating system you’d like to be able to deploy
  • ISO-files for each operating system you’d like to be able to deploy