Re: Time Error
- From: RWW-MCW <rth.wilcox@xxxxxxxxx>
- Date: Thu, 5 Nov 2009 09:34:46 -0800 (PST)
More details:
1.
The LastBootUpTime value in Win32_OperatingSystem is also an hour off.
2.
The =Now() function in Excel displays the correct time.
3.
I also get the correct time when I run the Time command in a command
prompt DOS-style shell.
4.
To prove that all other settings are correct and that there is
definitely an illogical discrepancy in WMI, I came up with the script
code below, ran it, and copied the output further below.
SCRIPT:
=========================
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
WScript.Echo "Script executed: " & Now()
WScript.Echo
Set colItems = objWMIService.ExecQuery(_
"Select * From Win32_OperatingSystem")
For Each objItem in colItems
WScript.Echo "Win32_OperatingSystem:"
WScript.Echo "Caption = " & objItem.Caption
WScript.Echo "CSDVersion = " & objItem.CSDVersion
WScript.Echo "OSArchitecture = " & objItem.OSArchitecture
WScript.Echo "ServicePackMajorVersion = " & _
objItem.ServicePackMajorVersion
WScript.Echo "ServicePackMinorVersion = " & _
objItem.ServicePackMinorVersion
WScript.Echo "Version = " & objItem.Version
strLocalDateTime = objItem.LocalDateTime
WScript.Echo "CurrentTimeZone = " & _
objItem.CurrentTimeZone
WScript.Echo "LocalDateTime = " & objItem.LocalDateTime
strTime = Mid(strLocalDateTime, 9, 2) & ":" & _
Mid(strLocalDateTime, 11, 2) & ":" & _
Mid(strLocalDateTime, 13, 2)
strDate = Mid(strLocalDateTime, 5, 2) & "/" & _
Mid(strLocalDateTime, 7, 2) & "/" & _
Left(strLocalDateTime, 4)
strTZ = Right(strLocalDateTime, Len(strLocalDateTime)-21)
dtmDateTime = CDate(strDate & " " & strTime)
Wscript.Echo "LocalDateTime = " & dtmDateTime & _
" (GMT" & strTZ & ")"
Wscript.Echo "----------"
Next
Set colItems = objWMIService.ExecQuery(_
"Select * From Win32_LocalTime")
For Each objItem in colItems
strTime = objItem.Hour & ":" & objItem.Minute & ":" & _
objItem.Second
strDate = objItem.Month & "/" & objItem.Day & "/" & _
objItem.Year
dtmDateTime = CDate(strDate & " " & strTime)
WScript.Echo "Win32_LocalTime:"
Wscript.Echo "LocalTime = " & dtmDateTime
Wscript.Echo "----------"
Next
Set colItems = objWMIService.ExecQuery(_
"Select * From Win32_UTCTime")
For Each objItem in colItems
strTime = objItem.Hour & ":" & _
objItem.Minute & ":" & objItem.Second
strDate = objItem.Month & "/" & _
objItem.Day & "/" & objItem.Year
dtmDateTime = CDate(strDate & " " & strTime)
WScript.Echo "Win32_UTCTime:"
Wscript.Echo "UTCTime = " & dtmDateTime
Wscript.Echo "----------"
Next
Set colItems = objWMIService.ExecQuery(_
"Select * From Win32_ComputerSystem")
For Each objItem in colItems
WScript.Echo "Win32_ComputerSystem:"
WScript.Echo "CurrentTimeZone = " & _
objItem.CurrentTimeZone
WScript.Echo "DaylightInEffect = " & _
objItem.DaylightInEffect
WScript.Echo "EnableDaylightSavingsTime = " & _
objItem.EnableDaylightSavingsTime
Wscript.Echo "----------"
Next
Set colItems = objWMIService.ExecQuery(_
"Select * From Win32_TimeZone")
For Each objItem in colItems
WScript.Echo "Win32_TimeZone:"
WScript.Echo "Description = " & objItem.Description
WScript.Echo "Bias = " & objItem.Bias
WScript.Echo "DaylightBias = " & objItem.DaylightBias
WScript.Echo "Daylight Month/Day = " & _
objItem.DaylightMonth & "/" & objItem.DaylightDay
WScript.Echo "DaylightName = " & objItem.DaylightName
WScript.Echo "StandardBias = " & objItem.StandardBias
WScript.Echo "Standard Month/Day = " & _
objItem.StandardMonth & "/" & objItem.StandardDay
WScript.Echo "StandardName = " & objItem.StandardName
Next
=========================
OUTPUT:
=========================
Script executed: 11/5/2009 12:29:08 PM
Win32_OperatingSystem:
Caption = Microsoftr Windows VistaT Enterprise
CSDVersion = Service Pack 2
OSArchitecture = 32-bit
ServicePackMajorVersion = 2
ServicePackMinorVersion = 0
Version = 6.0.6002
CurrentTimeZone = -300
LocalDateTime = 20091105132908.265000-240
LocalDateTime = 11/5/2009 1:29:08 PM (GMT-240)
----------
Win32_LocalTime:
LocalTime = 11/5/2009 12:29:08 PM
----------
Win32_UTCTime:
UTCTime = 11/5/2009 5:29:08 PM
----------
Win32_ComputerSystem:
CurrentTimeZone = -300
DaylightInEffect = False
EnableDaylightSavingsTime = True
----------
Win32_TimeZone:
Description = (GMT-05:00) Eastern Time (US & Canada)
Bias = -300
DaylightBias = -60
Daylight Month/Day = 3/2
DaylightName = Eastern Daylight Time
StandardBias = 0
Standard Month/Day = 11/1
StandardName = Eastern Standard Time
=========================
Note that the time and offset/bias values for LocalDateTime do not
match ANY other values.
The LocalDateTime value, and anything that uses it, are simply WRONG.
(I haven't tested the script on WinXP, but the discrepancies are
the same in XP when viewed via CIM Studio.)
I would also point out that the old time change from EDT to EST was a
week EARLIER than it is now. So, nothing will be any different in mid-
November in our area (as Meanon indicated might be the case for his
area).
Is anyone else seeing this? I would love to hear back from Pegasus or
any other MVPs... or anyone for that matter.
Thanks.
.
- References:
- Time Error
- From: Meanon
- Re: Time Error
- From: RWW-MCW
- Re: Time Error
- From: Meanon
- Re: Time Error
- From: Pegasus [MVP]
- Re: Time Error
- From: RWW-MCW
- Re: Time Error
- From: RWW-MCW
- Re: Time Error
- From: Meanon
- Time Error
- Prev by Date: Chkdsk question
- Next by Date: RE: ntldr missing
- Previous by thread: Re: Time Error
- Next by thread: Re: Time Error
- Index(es):
Relevant Pages
|