Hello Everyone,
Having difficulty getting below line of code to execute. It doesn't like the format of $iDracNode.RacIP. It only take "RacIP" and fails to connect/translate to IP held in the variable.
I've tried replacing $iDracNode.RacIP with xx.xxx.xxx.xxx and it works. Also works if I use variable such as $IP.
Is there a way to format the below to get the value of $iDracNode.RacIP instead of just "RacIP" when executing the script?
$iDracData
Code Snippet as a whole.
Having difficulty getting below line of code to execute. It doesn't like the format of $iDracNode.RacIP. It only take "RacIP" and fails to connect/translate to IP held in the variable.
I've tried replacing $iDracNode.RacIP with xx.xxx.xxx.xxx and it works. Also works if I use variable such as $IP.
Is there a way to format the below to get the value of $iDracNode.RacIP instead of just "RacIP" when executing the script?
Code:
invoke-expression "plink.exe -ssh -batch -l $iDracNode.RacIP -u $racuser -pw $racpass set system.servertopology.AisleName $iDracNode.PartNum"
$iDracData
Code:
PartNum : 555
RackNum : 4
RacIP : xxx.xxx.xxx.xxx
RU : 4
Serial : serial
RackLocation : RDC
PartNum : 77kl
RackNum : 3
RacIP : xxx.xxx.xxx.xxx
RU : 676
Serial : serial
RackLocation : RDC
Code Snippet as a whole.
Code:
$iDracData = Import-Csv $csvFileName
foreach($iDracNode in $idracData)
{
write-host -ForegroundColor Green "Setting node information for iDrac node:"$iDracNode.RacIP
invoke-expression "plink.exe -ssh -batch -l $iDracNode.RacIP -u $racuser -pw $racpass set system.servertopology.AisleName $iDracNode.PartNum"
}