try { Add-Type -Path 'C:\Program Files (x86)\OPC Labs QuickOPC 2017.2\Assemblies\net452\OpcLabs.EasyOpcUA.dll' } catch {} if (Test-Path .\DataLogger.csv) {Remove-Item .\DataLogger.csv} # DIM $arrMonitoredItems = @() # QuickUAClient $clientConfig = New-Object OpcLabs.EasyOpc.UA.EasyUAClientConfiguration $client = New-Object OpcLabs.EasyOpc.UA.EasyUAClient #Server $myEndPoint = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer' #DataNodes $nsuDataNodes = @( 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1285', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1259', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1276', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1274', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1275', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1278', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1279', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1280', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1244', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1280', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1267', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=1288', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=29', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=11', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=20', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=18', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=19', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=24', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=22', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=23', 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=4' 'nsu=http://opcfoundation.org/UA/Boiler/;ns=4;i=15' ) #EventHandling $myEventHandlerConfig = Register-ObjectEvent -InputObject $clientConfig -EventName LogEntry -Action { $EventArgs >> .\ClientEventLog.log} $myEventHandler = Register-ObjectEvent -InputObject $client -EventName DataChangeNotification -Action { $EventArgs.DisplayString >> .\DataLogger.csv} #Prepare Subscription foreach($DataNode in $nsuDataNodes) { $myVar = [OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments]::new("", $myEndPoint, $DataNode) $myVar.SubscriptionParameters = 100 $myVar.MonitoringParameters = 100 $arrMonitoredItems += $myVar } #Subscription $client.SubscribeMultipleMonitoredItems($arrMonitoredItems)