Doing a setup script I want the user to type in a new static IP address for this specific NIC (there is already a static IP on this NIC, so the script needs to change it). But I only get this error message when I give a different IP than the currently defied IP
Set-NetIPAddress : No matching MSFT_NetIPAddress objects found by CIM query for instances of the ROOT/StandardCimv2/MSFT_NetIPAd
dress class on the CIM server: SELECT * FROM MSFT_NetIPAddress WHERE ((IPAddress LIKE 'XX.XX.XX.XX')) AND ((InterfaceIndex = 7
)). Verify query parameters and retry.
At line:9 char:1
+ Set-NetIPAddress -InterfaceIndex 7 -IPAddress $SDDIPAddress
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (MSFT_NetIPAddress:String) [Set-NetIPAddress], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound,Set-NetIPAddress
If I try to change to the address that is already on the card, the script goes through. I can change the mask to whatever I want without problems with the script as it is.
I have isolated the few lines of script I need to activate this issue
[String]$SDDIPAddress = "SDD IPaddress"
[String]$SDDMask = "Bits in SDD netmask"
$SDDIPAddress = Read-Host -Prompt 'IP'
$SDDMask = Read-Host -Prompt 'Bits in mask'
Set-NetIPAddress -InterfaceIndex 7 -IPAddress $SDDIPAddress
Set-NetIPAddress -InterfaceIndex 7 -PrefixLength $SDDMask
Does anyone see the obvious I don't??
Im expecting a script that will change the IP address to the address given by the user