Windows IoT Core remote administration using PowerShell

Posted on 30th August 2016

PowerShell is a command line scripting environment for administrators to perform administrative tasks on Windows machines both locally and remotely. Using PowerShell you can also configure and manage your Raspberry Pi device running Windows IoT Core. This article explains how to remotely connect and run PowerShell commands on your Windows IoT device.

Step-1: Start Windows PowerShell

To start PowerShell from a Windows 10 PC, type powershell in Search the web and Windows. Right click on Windows PowerShell and select Run as administrator. This will open the PowerShell console.

Start Powershell

Step-2: Start WinRM service

Windows Remote Management (WinRM) service must be running to manage a device remotely. To start WinRM service run the command net start WinRM in PowerShell

PS C:\> net start WinRM
The Windows Remote Management (WS-Management) service is starting.
The Windows Remote Management (WS-Management) service was started successfully.

Step-3: Add Window-IoT device as a trusted host

In this step you add the remote Windows IoT device as a trusted host for Windows Remote Management, which means the local computer does not need to authenticate that device's identity. The TrustedHost value of WS-Man provider of is set using the Set-Item cmdlet. The below example sets a Windows IoT device with hostname as Eppy to the list of trusted host. You could also use the device's IP address instead of hostname if it is fixed. Run the Set-Item cmdlet as shown below and press Y to confirm the modification.

PS C:\> Set-Item WSMan:\localhost\Client\TrustedHosts -Value Eppy

WinRM Security Configuration.
This command modifies the TrustedHosts list for the WinRM client. The computers in the TrustedHosts list might not be authenticated. The client might send credential information to these computers. Are you sure that you want to modify this list?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

Step-4: Start a PowerShell session

You can now start a interactive PowerShell session with your remote Windows IoT device by issuing the Enter-PSSession cmdlet

PS C:\> Enter-PSSession -ComputerName Eppy -Credential Eppy\Administrator
[Eppy]: PS C:\> 

In the above example a PowerShell session is started with a remote device with hostname Eppy and connecting as Administrator user. A dialog box will prompt you to enter the password for the Administrator user. Remember the default password for Administrator user is p@ssw0rd

It may take upto 30 seconds to establish the connection and once the connection is made the command prompt will be prefixed by the remote computers hostname(or IP address).

You may now run any PowerShell command to manage your Windows IoT device. For example to get a list of all running processes, run Get-Process cmdlet.

[Eppy]: PS C:\> Get-Process | more

Finally to exit the remote PowerShell session use the Exit-PSSession cmdlet.

Post a comment


Nothing the first to share wisdom.