Tuesday, June 6, 2017

Save Your Time Typing Local Hostname

Hi folks,

This is probably my shortest blog post. If you are just lazy as I am and if you employ a hard-to-remember naming convention for your computers and servers there is a default variable $env:COMPUTERNAME which retrieves local computers hostname. So for example if you want to run a command to check health of the local Exchange server this command will be at your disposal:

Get-ServerComponentState -Identity $env:COMPUTERNAME