Highlighted
Absent Member.. mgjohansen Absent Member..
Absent Member..
1811 views

ovdeploy and PowerShell parameters

Jump to solution

Hi all.

 

I'm trying to get ovdeploy to execute a remote PowerShell script where I have deffined a function and three mandatory parameters. The three parameters in the PowerShell script needs to be able to take "space seperated" values and because of that I need to pass them in double quotes. E.g. -someparameter "Test text".

 

When trying it this way the script fails:

ovdeploy -cmd "powershell -command '& { . C:\posh\script.ps1;SEND-TEXT -Group "oncall-group" -Subject "Test" -Body "Test it" }'" -node server.local

Error returned is this:

HP Software Deployment 11.11.025

Unrecognized argument 'it }''.

 

I think I got to many double quotes (") in there, but can't seem to get the syntax right.

 

This works when removing some of the double qoutes, but then the PowerShell script can't take space seperated values as input to the parameters:

ovdeploy -cmd "powershell -command '& { . C:\posh\script.ps1;SEND-TEXT -Group "oncall-group" -Subject Test -Body Test }'" -node server.local

 

Can anybody help me out getting this syntax correct so ovdeploy and PowerShell will take the parameters as "space seperated" ?

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: ovdeploy and PowerShell parameters

Jump to solution

Hello,

 

The problem are the double quotes around oncall-group. Because of those double quotes, the command you pass to ovdeploy ends at those quotes and the rest of the command line is interpreted by ovdeploy as additional options which leads to a syntax error.

 

In your example, the easiest would be to skip those double quotes as there is no space and thus no need for the double quotes.

 

But if you need space in the argument, then escaping the double quotes with a backslash may help:

 

ovdeploy -cmd "powershell -command '& { . C:\posh\script.ps1;SEND-TEXT -Group \"oncall-group\" -Subject Test -Body Test }'" -node server.local

 

Best regards,

Tobias

 

Tags (1)
0 Likes
3 Replies
Absent Member.. GTrejos7 Absent Member..
Absent Member..

Re: ovdeploy and PowerShell parameters

Jump to solution

Hello mgjohansen,

 

The ovdeploy command simply executes remotely whatever command you wish to a particular node. This question is more a scripting type of question than a OMU issue.

 

Best regards,

HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
If you liked it I would appreciate KUDOs.
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: ovdeploy and PowerShell parameters

Jump to solution

Hello,

 

The problem are the double quotes around oncall-group. Because of those double quotes, the command you pass to ovdeploy ends at those quotes and the rest of the command line is interpreted by ovdeploy as additional options which leads to a syntax error.

 

In your example, the easiest would be to skip those double quotes as there is no space and thus no need for the double quotes.

 

But if you need space in the argument, then escaping the double quotes with a backslash may help:

 

ovdeploy -cmd "powershell -command '& { . C:\posh\script.ps1;SEND-TEXT -Group \"oncall-group\" -Subject Test -Body Test }'" -node server.local

 

Best regards,

Tobias

 

Tags (1)
0 Likes
Absent Member.. mgjohansen Absent Member..
Absent Member..

Re: ovdeploy and PowerShell parameters

Jump to solution

Solved the issue by dropping the PowerShell command into a .cmd file and calling that instead:

script.cmd file:
powershell -command "& {. C:\posh\script.ps1;SEND-TEXT -GroupOrPhone '%1' -Subject '%2' -Body '%3' }"

 Call from ovdeploy that accepts the three parameters:

ovdeploy -cmd "cmd /c C:\posh\script.cmd 'oncall-group' 'subject test' 'body test'" -node server.local

 

@tobias_m: 

Thx for explaining why it went wrong, knew there was somebody in here that could tell me what I did wrong with all those quotes 🙂

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.