This is a simple ThingWorx extension wrapping sc
command-line utility from Windows SDK (see details
in Windows Dev Center).
Currently it supports only querying Windows services, allowing you to
get the list and state of all configured services on the Windows box where ThingWorx is running. Usage is trivial:
try {
var windowsServices = Resources["WindowsServicesFunctions"].QueryServices();
} catch (ex) {
// Unsupported platform (Linux, Docker, no SDK, etc.)
}
This returns an INFOTABLE of WindowsService
shape like this:
name | description | type | state |
---|---|---|---|
AdobeARMservice | Adobe Acrobat Update Service | WIN32_OWN_PROCESS | RUNNING |
Appinfo | Application Information | WIN32 | RUNNING |
AppMgmt | Application Management | WIN32 | RUNNING |
- Download extension's ZIP file
- Make sure that your ThingWorx is configured to allow installing server-side extensions (ThingWorx 8.4+)
- Open ThingWorx Composer > Import/Export > Extensions > Import
- Select the ZIP file, upload and refresh the browser page as suggested
- You can use the extension, no need to restart the server
To upgrade the extension, you'll need to repeat the same steps as for installing. Don't forget to restart the server afterwards.
To remove the extension from your ThingWorx installation you'll need to:
- Check your code to make sure that you don't use it anywhere (a handy way to do it would be exporting all your entities "to source control",
i.e. as a bunch of XML files and do a
grep
over those files, looking forWindowsServicesFunctions
. - Uninstall it via Composer > Import/Export > Extensions > Manage
- Restart the server
Tested against the following versions of ThingWorx:
- ThingWorx 7.4.0-b159
- ThingWorx 8.4.3-b2219
Both on Windows 10 Version 1803 (OS Build 17134.885).
On Windows Docker containers run inside Hyper-V or VirtualBox VMs with MobyLinux, which means that technically speaking ThingWorx is running on Linux and
is not aware of the Windows hypervisor. Which in turn means it doesn't know anything about Windows' sc
command, so this extension won't work.
This extension depends only on the sc
utility, available as part of Windows SDK.
Make sure the SDK is installed before you use this extension. If you try using it without SDK or on Linux, you will get a runtime exception, so make sure you
catch it in the calling code.
There are no external Java dependencies.
This extension executes a command-line utility on the Windows PATH
. An evildoer with write access to any of the directories on the PATH can compromise its
results or execute malicious code under Tomcat user. This simplistic design has major implications on your server security, so please make sure you understand
it before using this extension.
Most importantly, do not install untrusted software on the server host, and make sure your Tomcat user has as few access rights as possible. But even then
there is a risk that this extension may compromise the system, so DON'T USE IT IN PRODUCTION, or better modify it to make it safer (e.g. use absolute
path to sc
, or use another mechanism altogether).
- Copy JAR files from ThingWorx Extension SDK into /twx-lib directory;
- Execute
ant -f build-extension.xml
Vilia does not support this extension, nor liable for any side effects of installing it on your ThingWorx system. Use it on your own risk. DO NOT USE IT IN PRODUCTION ENVIRONMNENT!