How do I change another computer's network settings from Powershell and/or .NET?
Solution 1:
I found the answer.
We can create a WMI object in PowerShell representing the network settings for IP-enabled adapters on a remote server.
$a = Get-WMIObject Win32_NetworkAdapterConfiguration -ComputerName MyServer -Filter IPEnabled=TRUE
This object will most likely be an array of network adapter objects of which only one is needed. So we want to point to that one, probably the first object in the array:
$a = $a[0]
Now we can configure whatever we want, including the IP address.
$a.EnableStatic("192.168.42.2", "255.255.255.0")
The one thing I couldn't figure out is how to determine the netmask!