Win32_LocalTime 클래스
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_LocalTime")
For Each objItem in colItems
strTime = objItem.Hour & ":" & objItem.Minute & ":" & objItem.Second
dtmTime = CDate(strTime)
Wscript.Echo FormatDateTime(dtmTime, vbFormatLongTime)
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_LocalTime")
For Each objItem in colItems
strTime = objItem.Hour & ":" & objItem.Minute & ":" & objItem.Second
dtmTime = CDate(strTime)
Wscript.Echo FormatDateTime(dtmTime, vbFormatLongTime)
Next
Win32_OperatingSystem 클래스
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_OperatingSystem")
For Each objItem in colItems
strTime = objItem.LocalDateTime
dtmTime = CDate(Mid (strTime, 9, 2) & ":" & Mid(strTime, 11, 2) & ":" & _
Mid(strTime, 13, 2))
dtmTime = CDate(dtmTime)
Wscript.Echo FormatDateTime(dtmTime, vbFormatLongTime)
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_OperatingSystem")
For Each objItem in colItems
strTime = objItem.LocalDateTime
dtmTime = CDate(Mid (strTime, 9, 2) & ":" & Mid(strTime, 11, 2) & ":" & _
Mid(strTime, 13, 2))
dtmTime = CDate(dtmTime)
Wscript.Echo FormatDateTime(dtmTime, vbFormatLongTime)
Next
물론 원격 컴퓨터의 시간을 확인할려면 RPC 권한이 있어야 하고, Active Direcotry 환경에서는 주기적인 시간 동기화가 되므로 위와 같은 조회가 필요없겠죠?.. ^^
03-TechNetB_masthead_ltr.gif
댓글 없음:
댓글 쓰기