Date and Time settings
This blog is going to cover the basic of viewing and changing your time settings. If you are like me I seem to always forget to set the correct time zone and need to correct it after the install.
How to view Date and Time settings
Viewing the date and time is very strait forward. This is one of the simplest PowerShell cmdlet to work with.
Get-Date | format-list *
In the sample output below I demonstrate both of the above commands.
How to change Date and time setting
I am not sure why, but this one took me some time to figure out. None of the examples on the Get-Help showed the syntax for just setting the date and time. Below is the syntax I used to set the date and time on this computer.
Set-date "12/12/2012 10:30 PM"
The output below shows the time was changed. Keep in mind that domain joined computers by default will sync their time from a domain controller. This can make your time change short lived.
How to View the current Time Zone
I had to use WMI calls to get the time zone. Below is the syntax I used.
As you can see below this command show you what time zone this computer is in.
How to Change the Time zone setting
I searched for a simple one line method in PowerShell to set the time zone and came up empty. The only easy way I found to do this in a one liner is using a command line utility tzutil.exe.
TZUTIL /s "US Eastern Standard Time"
How to get a complete list of Time Zones
TZUTIL /l > timezone.txt
Since this output is large and scrolls off the screen I piped it to an output text file and opened the file with notepad
I hope you found this useful. Please leave me a comment. Let me know if there are any core tasks you would like me to cover.