Related configuration for "Windows10iot Development series" PowerShell

Source: Internet
Author: User

Original: Related configuration of "Windows10 IoT development Series" PowerShell

You can use Windows PowerShell to remotely configure and manage any Windows IoT core device. PowerShell is a task-based command-line shell and scripting language designed for system administration. 1. Start a PowerShell (PS) session

Note: to start a PS session with the WINDOWS10 Iotcore device installed, you first need to create a trust relationship between the host computer and the device.

When you start a Windows IoT core device, an IP address appears on the screen that is connected to the device:

( ![Windows 10 IoT 核心版上的CoreDefaultApp](/content/images/DefaultApp.png) 可在Windows10 IoTCore Watcher实用工具中找到相同信息。 )

Windows10iot Core Boot interface

Start the Administrator PS Console on your local computer.

(Type "PowerShell" in the search Web and Windows text box next to the Windows Start menu)

Search PowerShell

To start PS as an administrator, right-click the Windowspowershell key and select Run as Administrator:

Administrator Status

PowerShell console:

PowerShell Main interface

Note: You need to start the WinRM service on the desktop to enable remote connections, in the Powershell console, enter:

net start WinRM

in the PowerShell console, type the following command to use the appropriate values instead

Set-itemwsman:\localhost\client\trustedhosts-value

Enter Y to confirm the change.

    • Now, to start the session using the Windows IoT core device, in the Administrator status PS console, type:

    • enter-pssession-computername-credential \administrator

In the Credentials dialog box, enter the following default password:[email protected]

Run successfully

Change your account password: issue the following command in a PowerShell connection

netuser Administrator [New password]

After you complete the operation, you need to use Exit-pssession and enable-pssession with the new credentials to establish a new PowerShell session.

Exit-pssession Enter-pssession-computername-credential\administrator

2.Visual Studio Remote Debugger troubleshooting

In order to be able to deployment applications from Visual Studio 2015, you need to make sure that the Visual Studio Remote debugger is running on the Windows IoT core device. The remote debugger should start automatically when the computer starts, to check the startup situation, use the tlist command to list all running processes in PowerShell , and two msvsmon.exe instances should be running on the device.

The Visual Studio remote debugger may have timed out after a long period of inactivity. If visual Studio cannot connect to your Windows IoT core device, try restarting your device.

3. Configuring Windows IoT Core Devices

To change the computer name, use the setcomputername utility:

Setcomputername

Restart the device for the changes to take effect, using the shutdown command:

SHUTDOWN/R/T 0

After restarting, you need to rerun this command to connect to the device because the computer name has changed:

Set-itemwsman:\localhost\client\trustedhosts-value

4. Known Issues and workarounds

Questions: A known bug in the PowerShell security policy causes the following problems with manifests in the remote session:

①get-help returns an exception match.

② the Get-command on the specified module returns a list of empty commands.

③ running cmdlets from any of the following modules will cause commandnotfoundexception:appx, Netadapter, netsecurity, Nettcpip, Pnpdevice.

④ Import-module on any of these modules will throw a Pssecurityexception exception (including unauthorizedaccess). Module auto-load does not seem to work either.

Workaround : Modify the execution policy within the remote PowerShell session to "remotesigned".

For more details on other execution policies, refer to the https://technet.microsoft.com/zh-cn/library/ee176961.aspx

Questions: have a , cmdlets (such as Netadapter) in some modules are not visible. For example, Get-module Netadapter will return an empty list.

Workaround: Use the "-force" parameter in conjunction with the Import-module. For example,import-modulenetadapter-force.

Questions: PS Remote control is interrupted when the execution policy is set to "AllSigned". Subsequent attempts to create a remote session failed, and SecurityException is loading typesv3.ps1xml.

Workaround: use Winrs.exe to restore Powershell execution policy:

① Changing the console code page Chcp65001

② logging into the remote Cmd.exe shell winrs.exe-r:-u:-p:cmd.exe

③ in remote cmd.exe, modify the corresponding registry key regaddhklm\software\microsoft\powershell\1\shellids\microsoft.powershell/v executionpolicy/d remotesigned/f

④ exiting a remote cmd.exe session Exit

The main resources for this article are from the Windows Development Center.

Configuration related to the "Windows10 IoT Development Series" PowerShell

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.