Wednesday, September 26, 2012

Get the Time of remote Offices Locations using Powershell script.

Hi.

If you are working in an MNC and you are multiple remote office then one thing is sure that you are visiting few TIME ZONES sites or have some WORLD clock installed on your System.

we have some remote offices and they all are on different geographical locations and on different time zones too, i can use any free World Clock software but my laptop already have too many software installed so i don’t want to install any more on it.

To solve this i decide to write a small script which can show me the Time of my all remote offices.

I created a small script which shows the time of “Local, Delhi, Dubai, Singapore and Manchester”.

You can download the script from this link : http://gallery.technet.microsoft.com/scriptcenter/Get-Time-of-Multiple-db9e5ef8

Screenshot of the script:
26-09-2012 00-06-00
Script Logic:

   1:  $RemoteTIme = New-Object -TypeName Psobject
   2:  $Dubai = (Get-Date).ToUniversalTime().AddHours(4).ToShortTimeString()
   3:  $RemoteTIme | Add-Member -MemberType 'NoteProperty' -Name Dub -Value $Dubai

The script logic is quite simple.

First i have created a new PS Object Named as $RemoteTime.

Then i created a variable for every country and in value i am converting  GET-Date to Universal Time and then i am adding hours and minutes according to the desired countries TIME offset with GMT.

Third i am adding members to our PSobject which we have create.

Note: I haven’t figure out yet how to automatic do the DST things. Will update you when i know that. In case you want to added the country which use DST setting , you need to manually add or subtract the HOURS accordingly.

Download  link : http://gallery.technet.microsoft.com/scriptcenter/Get-Time-of-Multiple-db9e5ef8

Thanks

Aman Dhally

join aman on facebook Join aman on Linkedin follow aman on Twitter

No comments:

Post a Comment