I have a Raspberry Pi 2 with Windows 10 ioT installed. How do I set the IP Address statically in code?
5 Answers
You can do this by connecting remotely to your device via Powershell and running "netsh".
You can perform a variety of tasks using the Netsh command-line utility, including configuring the IP addresses of network adapters in Windows.
Here’s how to configure a static IP address:
netsh interface ip set address "connection name" static 192.168.0.101 255.255.255.0 192.168.0.1
NOTE: The default connection names are Local Area Connection for wired adapters and Wireless Network Connection for Wi-Fi adapters. The IP address order: client IP, subnet mask, and gateway IP.
Here’s how to configure the DNS addresses:
netsh interface ip add dns "connection name" 208.67.222.222
netsh interface ip add dns "connection name" 208.67.220.220 index=2
NOTE: Remember to replace the connection names and IP addresses.

- 416
- 2
- 10
-
Yep. I get that. I'm wondering if it can be done via the Windows UAP 10 ioT application running on the device. – Bill Greer Aug 07 '15 at 16:57
-
I have not tried the Power-Shell method yet, but I am wondering if it will persist after a reboot. – Bill Greer Aug 19 '15 at 19:28
First start the session with iOT via Windows PowerShell Using PowerShell to connect and configure a device running Windows 10 IoT Core
Then follow How to Change Your IP Address Using PowerShell

- 206
- 2
- 6
I guess It's a bit late, but after several research, the only solution I have found out that works so far (C#) is using ShellStream class from SSH.NET (Renci):
SshClient client = new SshClient(host, username, password);
client.Connect();
ShellStream stream = client.CreateShellStream("shellName", 80, 24, 800, 600, 1024);
Then you can manipulate the stream through StreamReader/StreamWriter and call writeLine() to introduce the cmds into the Shell.
PS: You need to install SSH.NET using the Nuget Manager, by typing the next line on the console: Install-Package SSH.NET -Pre
Hope It helps.

- 23
- 5