I am tring to change the IP address with netsh within a script. I get the error: "parameter is incorrect" This is the script:
$ManagmentAddress = '192.168.11.130'
Invoke-Command -ComputerName $OldName -ScriptBlock {netsh interface ip set address "Ethernet0" static $ManagmentAddress 255.255.0.0 } -Credential $Creds
If I change the command to use actual value instead of the argument like this:
Invoke-Command -ComputerName $OldName -ScriptBlock {netsh interface ip set address "Ethernet0" static 192.168.11.130 255.255.0.0 } -Credential $Creds
It works.