Server Management - Remote Server Management
cancel
Showing results for 
Search instead for 
Did you mean: 

Set-HPiLOSchemalessDirectory doesn't accept variable in Powershell

 
SOLVED
Go to solution
Highlighted
Occasional Visitor

Set-HPiLOSchemalessDirectory doesn't accept variable in Powershell

When trying to set up iLO AD Groups using the HPiLO cmdlets in Powershell, I'm getting an error.  The code line is as follows:

Set-HPiLOSchemalessDirectory -GroupAccount Enable -server $server -DisableCertificateAuthentication - Credential $Creds $str

 

When the code runs, I get the following error:

A positional parameter cannot be found that accepts argument '-Group1Name group -Group1Priv "1,2,3,4,5,6" -Group1SID ""'

$str in the command is the string containing '-Group1Name group...Group1SID ""'

Following Group1SID are 2 double-quotes to make a blank entry ($Null does not work)

The odd thing is that I can manually type the command and replace $str with the copied contents from the error message, and it works fine.   Any assistance would be appreciated.  Thanks.

1 REPLY 1
Highlighted
Occasional Visitor
Solution

Re: Set-HPiLOSchemalessDirectory doesn't accept variable in Powershell

For those who may be having this issue:

Issue lies in the fact that you can't pass the parameter inside the variable; It must standalone within the command.  The following would work:

Set-HPiLOSchemalessDirectory -GroupAccount Enable -server $server -DisableCertificateAuthentication - Credential $Creds -Group1Name $G1Name -Group1Priv $G1Priv -Group1SID $G1SID