Set Static IP Address On SSID With Powershell

Just A Network Guy 1 Reputation point
2020-10-28T19:10:15.457+00:00

I need to set a static IP address for a specific SSID on Windows 10 via Powershell and can't seem to find a way to do it. I can do it via the Settings app but I need to script it. I can't set the IP address on the wireless NIC as I need it to still use DHCP on all wireless networks with the exception of the one I specify. I don't really care what the script is written in (Just thought Powershell would be easiest.), I just need to do it programmatically. Any help is much appreciated.

35835-wifi-ip-address.jpg

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Sean Liming 4,766 Reputation points Volunteer Moderator
    2020-10-29T03:15:15.823+00:00

    In power shell the call is New-NetIPAddress. For example, the manual process:

    Run Get-NetIPConfiguration

    locate the interfaceIndex for your wifi that you want to set, and then run the following:

    New-NetIPAddress -InterfaceIndex 15 -IPAddress 192.168.28.34 -PrefixLength 24 -DefaultGateway 192.168.28.1

    Every time you connect to that SSID just run the above line. Or do you need this more automated?

    0 comments No comments

  2. Anonymous
    2020-10-29T03:28:22.137+00:00

    Hi,

    You can run Get-NetIPInterface to get the Interface Index, then set the static IP like this

    Set-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168.0.1 -PrefixLength 24  
    

    https://learn.microsoft.com/en-us/powershell/module/nettcpip/set-netipaddress?view=win10-ps

    Best Regards,
    Ian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Just A Network Guy 1 Reputation point
    2020-10-29T13:50:16.867+00:00

    I don't want to set it on the Interface as a whole, I just want it set for the SSID and don't want to have to run the command every time I connect to the SSID. It can be done via the GUI as seen in the image, but I can't find a way to do it via Powershell.

    0 comments No comments

  4. Just A Network Guy 1 Reputation point
    2020-10-29T13:53:38.933+00:00

    The reason I need to do this is that I have about 1000 tablets I have to send to the field. When they are in one of our facilities, they need to connect to a specific SSID and have a static IP address assigned. When they are not in our of our facilities, they need DHCP to work. I know it's not the best design to require the table to have a static IP address when in our facilities, but unfortunately that's the requirement of the application I have to support. The reason for needing to do this via Powershell is that it needs to be part of the staging process when the tablet is imaged as the users don't have access to change network settings and they would just get confused.


  5. Sean Liming 4,766 Reputation points Volunteer Moderator
    2020-10-29T20:22:48.53+00:00

    So you would have to write an application that monitors the SSID change and then set the static IP address. Here is an article on getting the SSID in PowerShell: Get Wireless Network SSID and Password with PowerShell

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.