Reputation: 63
How can I recieve system time from remote PC in local network within InTouch Scriptng or QuickScript.NET in Archestra IDE?
Upvotes: 1
Views: 3051
Reputation: 4523
You should be able to achieve any of the answers here : Get remote PC's date time?
QuickScript.NET Example
First, Import the System.Management
DLL from C:\Windows\Microsoft.NET\Framework\v4.0.30319
or wherever you have it located as a Script Function Library.
After that, use this script and tweak to your needs:
(I had this in an ArchestrA graphic with 2 text fields, datestring
and timestring
were tags tied to the display objects.
Script Condition: While refresh
== True :
dim pcname as System.String;
dim wmipath as System.String;
dim scope as System.Management.ManagementScope;
dim query as System.Management.ObjectQuery;
dim search as System.Management.ManagementObjectSearcher;
try
pcname = "192.168.10.190";
wmipath = System.String.Format("\\{0}\root\CIMV2", pcname);
scope = new System.Management.ManagementScope(wmipath);
query = new System.Management.ObjectQuery("SELECT * FROM Win32_LocalTime");
scope.Connect();
search = new System.Management.ManagementObjectSearcher(scope, query);
dim queryObj as System.Management.ManagementObject;
for each queryObj in search.Get()
datestring = System.String.Format("{0}-{1}-{2}", queryObj("Year"), queryObj("Month"), queryObj("Day"));
timestring = System.String.Format("{0}:{1}:{2}", queryObj("Hour"), queryObj("Minute"), queryObj("Second"));
LogMessage(datestring + " " + timestring);
next;
catch
LogError(error);
endtry;
refresh = false;
Upvotes: 1