Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Java SDK: Get property values from Windows Powershell

No ratings

I have put together a small sample of how to get property values from a Windows Powershell command into Thingworx through an agent using the Java SDK.

In order to use this you need to import entities from ExampleExport.xml and then run passing in the parameters shown in run-configuration.txt (URL, port and AppKey must be adapted for your system). ExampleExport.xml is a sample file distributed with the Java SDK which I’ve also included in the zipfile attached to this post. You need to go in Thingworx Composer to Import/Export … Import from File … Entities … Single File … Choose File … Import.

Further instructions / details are given in this short video:

Video Link : 2181


At 2:51 mins in the video I said “Application ID” but the correct term is “AppKey”. This allows the device to provide credentials which give permissions based on a user. In Thingworx Composer you can go to Security … Application Keys and generate an AppKey tied to a user ID. You will also need to define an Expiration Date otherwise I think it will default to 1 day only.

The run configuration I provided are the parameters that need to be passed to the Java program.

ws://localhost:8015/Thingworx/WS 97d6c8cb-13e3-4743-87ac-b868fbf6ad37 1000 1 10

So you will need to replace the values in bold above with values relevant to your system: serverName, port, AppKey. Just for info the numbers at the end (1000 1 10) control the demo program’s behaviour – incl. how many demo things it creates.

The URL above is using unencrypted web sockets which I assume is OK for your system but possibly you’ll need to use encryption (so wss:// )

Version history
Last update:
‎Jan 05, 2018 09:17 AM
Updated by:
Labels (3)