VMware Cloud Community
orian
Hot Shot
Hot Shot
Jump to solution

Run reg add program in vm

Hi,

I use "Run program in guest" workflow in order to run the flowing reg add command:

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Company /t REG_SZ /v team /f /d "operation"

The arguments variable which pass to  "Run program in guest" workflow:

arguments = "-command \"& {reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\Company /t REG_SZ /v team /f /d \"operation\"}"

In this case it works!

However if I pass a value with space it does not create the registry.

for example:

arguments = "-command \"& {reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\Company /t REG_SZ /v team /f /d \"operation department\"}"

if I run same command from the virtual machine it works:

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Company /t REG_SZ /v team /f /d "operation department"

What can be the solution for this space issue?

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
eoinbyrne
Expert
Expert
Jump to solution

Hmmmm... I'm guessing your actual command to the "Run program in guest" is powershell.exe

and you want to pass the "reg add" as the "command" argument there.

This might mean it's a powershell problem & not JS

try this perhaps?

arguments = "-command \"& {reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\Company \/t REG_SZ \/v team \/f \/d 'operation department'}\""

i.e., specify the value in single quoutes - 'operation department'

View solution in original post

Reply
0 Kudos
6 Replies
eoinbyrne
Expert
Expert
Jump to solution

I think you might have unbalanced quotes in this line?

pastedImage_0.png

Reply
0 Kudos
orian
Hot Shot
Hot Shot
Jump to solution

hi,

I added your suggestion in the end of the line, but the  problem still occurs.

Only if I have space in value, the registry is not created.

Any other ideas?

Thanks!

Reply
0 Kudos
eoinbyrne
Expert
Expert
Jump to solution

Try this? (escape the forward slashes too)

arguments = "-command \"& {reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\Company \/t REG_SZ \/v team \/f \/d \"operation department\"}\""

Reply
0 Kudos
orian
Hot Shot
Hot Shot
Jump to solution

same problem...

Reply
0 Kudos
eoinbyrne
Expert
Expert
Jump to solution

Hmmmm... I'm guessing your actual command to the "Run program in guest" is powershell.exe

and you want to pass the "reg add" as the "command" argument there.

This might mean it's a powershell problem & not JS

try this perhaps?

arguments = "-command \"& {reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\Company \/t REG_SZ \/v team \/f \/d 'operation department'}\""

i.e., specify the value in single quoutes - 'operation department'

Reply
0 Kudos
orian
Hot Shot
Hot Shot
Jump to solution

it works!

Thanks a lot!

Reply
0 Kudos