can someone please help me with writing a scriptable task or a workflow or an action item that modifies/set windows registry value data?
I've been searching online for it a while, but could not find any answer.
referral to examples would be great.
Thanks a lot!
To set/modify registry value, you can write a BAT script using reg command to access the registry. Here is an example showing how to set a string value to a given key:
reg add HKEY_LOCAL_MACHINE\SOFTWARE\MyKey /v PathName /t REG_SZ /d C:\TempDir /f
(Type reg add /? in a Windows terminal to get a list of possible options). Also note that you need to have enough privileges to be able to write to registry.
Once you get your BAT script ready and tested, you can use Guest Script Manager package to execute this script against a remote Windows VM.
thank you for the reply.
I used your recommendation, but seems like O have some error:
Error in (Workflow:Modify Windows Registry Value / Scriptable task (item1)#6) Wrapped java.io.IOException: Cannot run program "reg": error=2, No such file or directory
This is my script source:
// Prepare CMD string var cmdModifyWinReg = "reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\conf\\serversMetaData /v RestartType /t REG_SZ /d " + restartType + " /f"; System.log("Executing command: " + cmdModifyWinReg); //Execute CMD command var execCmd = new Command(cmdModifyWinReg); execCmd.execute(true); // Show script result var scriptResult = execCmd.result; System.log("Script result: " + scriptResult); // Show script output var scriptOutput = execCmd.output; System.log("Script output: " + scriptOutput);
what is wrong with my code?
No, the error you receive is not Java-related; the error message is about not being able to find reg command.
I assume you have deployed vRO appliance and run this workflow on it. vRO appliance is Linux-based machine, and reg.exe is a Windows utility program, so you need to run your code on Windows.
To do this, you need to make a BAT file (Windows batch script) and then use vRO's Guest Script Manager package to connect to your Windows machine and execute your BAT script there.
so you mean that I need to stream the bat file to the server from my workflow?
if so, how can I do this?
by the way, I have a powershell host, maybe I can use it to do these tasks of streaming PS1/BAT/CMD files...
can someone guide me through this please?