hi,
i would like to check the server datetime when ever my application start. The datetime must be the same with my pc datetime....How do i do that...Is there a way....
i got a code from somewhere but it doesn't work at all...can anyone help me on this....
Public Sub GetServerDateTime()
Dim WMIScope As Management.ManagementScope
Dim WMIConnectionOptions As New Management.ConnectionOptions
Dim oq As New System.Management.ObjectQuery
Dim query As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection
Dim Strcomputer As String = "111.222.333.58"
With WMIConnectionOptions
.Impersonation = System.Management.ImpersonationLevel.Impersonate
.Authentication = System.Management.AuthenticationLevel.Packet
End With
WMIScope = New Management.ManagementScope("\\" & _
Strcomputer & "\root\cimv2", WMIConnectionOptions)
oq = New System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem")
query = New ManagementObjectSearcher(WMIScope, oq)
queryCollection = query.Get()
For Each oReturn As ManagementObject In queryCollection
Debug.Print(oReturn("LocalDateTime").ToString())
Next
End Sub