Hello, having a weird issue. I wrote some code that will assign a random 192.168.0.x IP to a 10gb adapter on a remote machine. It works fine when run on 2k12r2 machines, but fails on 2k16 machines. I seem to have narrowed it down to the fact that my code grabs a list of the 10gb adapters on the machine, puts them into a variable, and then I select the first nic it grabbed by using $variable. This works on 2k12r2 but no 2016. For some reason, having the  on the end of the variable in 2016 causes:
The system cannot find the file specified.
+ CategoryInfo : ObjectNotFound: (MSFT_NetIPAddress:ROOT/StandardCimv2/MSFT_NetIPAddress) [New-NetIPAddress], CimException
+ FullyQualifiedErrorId : Windows System Error 2,New-NetIPAddress
+ PSComputerName : e-rack-14
Note the same command I am invoking can be run locally on the 2016 machine with the $variable. For some reason invoking it causes it to fail. Anyone know what is going on?
Well I just realized I was just thinking about this too hard. There is no reason for me to find the 192.x.x.x IP, then specify it to be removed. I realized that just remotely setting the adapter to DHCP accomplishes the same goal of removing the IP (Doesn't need to be specific in my case)
The topic ‘new-netipaddress $variable doesn't work in 2016 when invoked remotely’ is closed to new replies.