Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hi,
I am trying to get the current system time into a variable.
If I run get-natime I get:
Name Value
---- -----
UtcTime 1299518447
LocalTimeDT 07/03/2011 17:20:47
UtcTimeDT 07/03/2011 17:20:47
LocalTime 1299518447
This is as expected.
what I want is LocalTimeDT in a variable but the command:
get-natime | where-object {$_.Name -eq "LocalTimeDT"}
Does not return any data.
How can I get 'LocalTimeDT" in to a variable?
Solved! See The Solution
Have you tried (Get-NaTime).LocalTimeDT?
It appears to work for me:
***EDIT***
It looks like you may be using an older version of the toolkit where Get-NaTime returns a hashtable. In that case, the command (Get-NaTime).Item("LocalTimeDT") should do the trick.
Hope that helps!
Steven
Have you tried (Get-NaTime).LocalTimeDT?
It appears to work for me:
***EDIT***
It looks like you may be using an older version of the toolkit where Get-NaTime returns a hashtable. In that case, the command (Get-NaTime).Item("LocalTimeDT") should do the trick.
Hope that helps!
Steven
Steven,
Excellent the first answer works, my powershell knowledge needs improving! I tried to work it out by googling but it let me down
Hi,
We are now on BST time and the time from powershell (get-natime).localtimedt is an hour slow.
The time from a telnet session to the filer is correct and displays BST time.
Is they any way to get the BST time from the filer or is it a case of correcting it in powershell during summer months?
Thx.
It looks to me like this may be a bug in the way the time is reported to the toolkit. You can either add an hour to the time reported, or more generally:
Should get you to the correct time.
Hope that helps,
Steven
We have been able to verify that this is in fact a bug in the API. We are preparing a fix for the Get-NaTime cmdlet so that the correct local and UTC times are reported--look out for it in the next toolkit release.
Thank you for bringing this to our attention.
-Steven