How do you change the deviceName and deviceType in the Thingsboard Rule Engine? - thingsboard

Making a rule and manually change the incoming "deviceName" and "deviceType" in the metadata afterwards doing a "Save Timeseries" doesn't change the deviceName property. Is there some other node in the Rule Engine that I need to use?

Try Script Transformation Node

Related

How to change/swap a device instance ID using devcon in windows 10

I need to manually change a device instance ID for a driver on my system, because an used driver needs to have exactly the same device instance ID as on my other systems. Some systems install the driver and set the device instance id to ROOT\SYSTEM\0002 instead of ROOT\SYSTEM\0001.
How would I force the driver to install to ROOT\SYSTEM\0001 instead, or is it possible to be changed after install?
my output of devcon find #root\system*:
ROOT\SYSTEM\0000 : XXX
ROOT\SYSTEM\0001 : YYY
ROOT\SYSTEM\0002 : ZZZ
I want "ZZZ" to swap with "YYY" so "ZZZ" is ROOT\SYSTEM\0001
Can anyone give me a hint?

How programatically disable specific item in network connection properties?

I want to know if some API/code exists to disable a specific item in the (current) network connection properties?
If yes, could you show a working code example, explain the details, and point out some limitations (if they exist) of the technique used?
The API to disable these bindings is INetCfgBindingPath::Enable. The bindview sample illustrates how to call the API.
From Windows 8 and later, you may alternatively invoke the WMI method /root/standardcimv2/MSFT_NetAdapterBindingSettingData::Disable. Here's a line of PowerShell that illustrates how to disable the bindings from a NIC named "mb-port" to the "ms_msclient" driver (aka wkssvc):
Get-CimInstance -Namespace root/standardcimv2 -Query 'SELECT * FROM MSFT_NetAdapterBindingSettingData WHERE Name = "mb-port" AND ComponentID = "ms_msclient"' | Invoke-CimMethod -MethodName Disable
Note that the GUI is being sneaky: it merges multiple bindpaths into the same checkbox. In the example you have highlighted, there are likely 2 bindpaths from ms_msclient to the NIC: one over IPv4 and one over IPv6. The GUI disables/enables all paths when you clear/tick the checkbox. If you come in through the API and want to do the same, you'll need to enumerate all bindpaths that start from ms_msclient and go to the NIC mb-port.

Unable to change clearcase stream mastership?

I'm trying to change mastership of stream from "BLR" to "LON" but facing below error.
You must change mastership manually for the following branch types clearcase:
spider_dev_1.1#\spider_projects
Command using:
multitool chmaster –stream LON stream:spider_dev_1.1#\spider_projects.
How to get past this error message?
Then try to do just that (ie. changing mastership manually for the branch type mentioned):
multitool chmaster LON brtype:spider_dev_1.1#\spider_projects
Then try again changing mastership of the stream.
Somehow I have a bad feeling about this. Please tell me that this type name was a typo:
clearcase:spider_dev_1.1
Generally speaking, when you see a type name in the form foo:bar#\vobtag, it means that there was a type name conflict somewhere. And the name before the type name is a replica name.

How do I determine the status of a specific service?

I'd like to run a command that will give me the status of a specific windows service. Using sc query, I was able to get this information, see below.
C:\Windows\System32>sc query "IBM Cognos"
SERVICE_NAME: IBM Cognos
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
The only bit of information that I really need to access is the "STATE". Can I filter the output so I am only seeing the STATE or "1 STOPPED"? I was hoping I could do something like:
sc query[STATE] "IBM Cognos"
My ultimate goal is to run a .bat file that will output the status of a service to a file. I can then read that file from another program and use that value to determine whether I should display a green icon indicating "started" or a red icon indicating "stopped" to the user in the UI.
Thanks in advance for your help,
Jeff
How about:
sc query "IBM Cognos" | find "STATE"
Should return something like:
STATE : 1 STOPPED

Windows XPE service installation - how to set security at CreateService time?

I'm using CreateService to install a windows service on Windows XPE. I'd like to set things up so that only the Administrator can start/stop/pause/resume the service.
Right now I'm using the following to install the service:
schService = CreateService(schSCManager,
ServiceName,
ServiceDisplayName, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS, // service type
SERVICE_AUTO_START, // start type
SERVICE_ERROR_NORMAL, // error control type
binaryPathName, // service's binary (this program)
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL); // no password
And the service ends up with security such that members of the PowerUsers group can start and stop the service. I've figured out that I can use sc sdshow to examine the security descriptor, and I've worked out an SDDL line that would do the right thing for us.
I've also learned that our Win XPE install doesn't have the sc.exe binary on it, so we can't really use that to setup this particular system.
So, what I need to know is: What are the APIs I need to use, to set the security descriptor on this service around the time I do the CreateService call. I'm completely unfamiliar with the Windows security APIs, so I just don't know where to start.
UPDATE: The answer is SetServiceObjectSecurity (below). Next question: What's the best way to setup the SecurityDescriptor? Is it best to get the default descriptor, then modify it? Or should I just create a completely new descriptor?
I'm not really familiar with Windows XP Embedded, but normally you would achieve what you are after using the SetServiceObjectSecurity function. Use the handle you get from CreateService and build a security descriptor that matches what you want.

Resources