Windows PowerShell is a command-line utility that runs on your Windows 10 computer, and allows you to execute commands on a Windows IoT device, like a Raspberry Pi.
PowerShell has lots of uses, but we’ll focus on setting applications to run at startup in Windows IoT.
PowerShell should appear in the All Apps
submenu of your Start menu, as Windows PowerShell
Make sure you run PowerShell as “Administrator”. To do this, right-click on the PowerShell icon and select Run as Administrator
from the popup.
If you can’t find it there, you can type Windows PowerShell
into the Cortana box (lower left of your screen) to have Windows find it for you.
You’ll be asked if you want to allow PowerShell to make changes to your system. This is because you ran it as Administrator. Click OK. The PowerShell console window will open.
Initially, PowerShell is open you the windows\system32
directory on your computer. So, the first step we need to do is to connect PowerShell to your Windows IoT device.
PowerShell needs the WinRM service to be running on your computer. On the PowerShell command line, type
net start WinRM
The next step is to establish a “trusted” relationship between your computer and the Windows IoT device. This is done with the Set_Item command:
Set-Item WSMan:\localhost\Client\TrustedHosts –Value <machine-name or IP address>
Substitute the name of your IoT device, or use its IP address. Both are available on the standard Windows IoT start screen. Our Raspberry Pi still has the default name of minwinpc:
Windows will ask you to confirm that you want to modify the list of trusted computers. Reply ‘Y’ to confirm:
With that out of the way, we can start a command line session on the Raspberry Pi. The command looks like this
Enter-PSSession -ComputerName <machine-name or IP Address> -Credential <machine-name or IP Address or localhost>\Administrator
Again, substitute the name or IP address of your Raspberry Pi. Mine is still minwinpc:
When you execute the Enter_PSSession
command, an authentication window will pop up. Enter the Windows IoT password for your Raspberry Pi. The default password is p@ssw0rd.
Enter your password and click OK. It may take a minute or so for the command to complete. When it does, you’ll see a new command-line prompt, showing that you are in a Documents
directory. You are now ready to execute PowerShell commands on your Windows IoT Core Raspberry Pi:
Page last edited July 20, 2016
Text editor powered by tinymce.