fixlet to change subnet mask

Hello,

I am trying to write a fixlet that will identify systems in a certain subnet, and then change the subnet mask of these systems. Can anyone lend some advice?

Many thanks,

Which OS?

What command would you run to do this if you were at the terminal for the machines in question?

These servers will be Windows 2008 r2 through Windows 2016 Std. Normally I would just do it through the GUI, but there are too many.

Iā€™d look at using netsh as the command-line tool for this.

Use relevance to pick off the correct adapter (friendly name of adapters of network to get the adapter name as known by netsh)

I used netsh to update DNS on all of our servers before. It would definitely work for this but I think to change the subnet you also have to specify the IP and gateway with netsh, so a few variables would be needed.

netsh interface ip add dnsserver ā€œ{name of connection whose (status of it = (connection status connected)) of network}ā€ X.X.X.X index=1

I ran into a couple issues where multiple nic servers would fail, so i changed it to be more scoped.

1 Like