cancel
Showing results for 
Search instead for 
Did you mean: 
CatnJun
Level 1
2 1 1 0
Message 1 of 2
199
Flag Post
HP Recommended

Solved!

Set-HPiLOSchemalessDirectory is not working with variables

Powershell
Microsoft Windows Server 2016

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
CatnJun
Level 1
2 1 1 0
Message 2 of 2
153
Flag Post
HP Recommended

Solved!

Set-HPiLOSchemalessDirectory is not working with variables

For those who may have this issue, the problem lies with passing parameters for the powershell cmdlets.  The parameter name (i.e. -group1name, group2name, etc.) may not be passed from within a variable.  It must be a standalone item as is the -server and -Credential parameters shown in the example.  The following would succeed:

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

Reply
0 Kudos
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation