Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Can I Take Date and Time of other computers over Lan??!

Why This script not work currectly at my Network?

What I have tried:

<pre><pre lang="vb">
<pre>Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "DESKTOP-2ACDFQ"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=Impersonate," _
    & "authenticationLevel=Pkt}!\\" _
    & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
    dtmConvertedDate.Value = objOS.LastBootUpTime
    dtmLastBootUpTime = dtmConvertedDate.GetVarDate
    dtmSystemUptime =  Now
Wscript.Echo dtmSystemUptime 
Next
Posted
Updated 20-Dec-17 18:02pm
v2
Comments
David_Wimbley 21-Dec-17 21:22pm    
You haven't indicated what error you are receiving so unfortunately only you know why the script won't work at your network.

Its probably due to either a firewall, credential or permissions issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900