![](/img/trans.png)
[英]System.PlatformNotSupportedException: 'Windows Principal functionality is not supported on this platform.'
[英]Wonderware System Platform. How to get DateTime from remote PC?
如何在Archestra IDE中的InTouch Scriptng或QuickScript.NET中从本地网络中的远程PC接收系统时间?
您应该能够在这里获得任何答案: 获取远程PC的日期时间?
QuickScript.NET示例
首先,从C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319
或您作为脚本功能库定位的任何位置导入System.Management
DLL。
之后,使用此脚本并调整您的需求:
(我在带有2个文本字段的ArchestrA图形中使用了此功能, datestring
和时间timestring
是与显示对象相关timestring
的标签。
脚本条件: 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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.