This post is more than 5 years old
1 Message
0
5825
April 7th, 2016 08:00
Using powershell variables in RACADM commands
I have a powershell script that I'm using to look through a CSV file to assign a static iDRAC IP based on serial number.
Here is a command that is working great!
racadm -r $oldIP -u root -p calvin set iDRAC.IPv4.Gateway $gw
the $oldIP and $gw are the variables that have been assigned values previously in my script.
I can verify with 'get iDRAC.IPv4' and all is well with the gateway.
I assign the $gw in the exact same way that I assign the $newIP variable.
Here is the command that will not work with the PowerShell variable:
racadm -r $oldIP -u root -p calvin set iDRAC.IPv4.Address $newIP
Returns: "Error: RAC947: Invalid object value specified."
If I use the exact same command (by hitting the up arrow to get the previous command) and replace $newIP with the actual IP, it works great...if I wanted to manual enter each IP....which I don't.
I can verify that $newIP is actually assigned the value I need by just calling it separately. Looks good. It 'SHOULD' work. Especially if $gw works fine.
I've tried every which way from Wednesday to get this to work. Rearranging things in the code. Made sure that iDRAC.IPv4.DHCPEnable 0 and iDRAC.IPv4 Enable 1 are set. Researching for hours trying to find an explanation or reason for the failure. Can't find anything.
Can the iDRAC.IPv4.Address command not take anything except an IP address that is actually typed in? Some sort of validation?
Does anyone have any ideas as to why this isn't working?
RACADM version 8.1.0 build 1518 (yeah...I looked into that too).



nuculeuz
1 Rookie
•
1 Message
0
June 27th, 2024 11:18
Probably smth with the transferred variable. Inside RACADM the remote server will not know the $newIP variable, but treat it as a string - which is not an allowed value for the new IP. :-)
$using:newIP instead of $newIP should solve the issue.
(edited)