PowerShell on Windows Embedded Standard 2009 – Part 1: Making it Available on a Device
Introduction
Microsoft recently released both Windows PowerShell version 1.0 (V1) and version 2.0 (V2) as a Community Technology Preview (CTP).
PowerShell is a powerful scripting tool that simplifies the management of computer systems and devices. The tool is designed using object oriented model and .NET framework therefore it is very easy to execute .NET, COM, and WMI objects.
Windows Embedded devices such as Point-of-Service (POS) terminals, Kiosks, networked printers, or even Thin Clients normally require local or remote management services. Service professionals or IT managers frequently use a scripting tool to automate the service functions. Compared to other scripting tools or languages, such as VBScript or Jscript, one will find it is much easier to write simpler yet more powerful code with PowerShell. For this reason, PowerShell will certainly stand out among other scripting tools to fulfill device management services.
The purpose of this article is to explore how to make PowerShell available on embedded devices built with Windows Embedded Standard 2009, and how to use it for remote device management. This article is divided into two parts. The first part focuses on how to make PowerShell available on an embedded device, whereas the second part on configuring a device for remote management and demonstrating some fun examples.
**Please note that information described in this article is for testing purpose only and is not officially supported by Microsoft.
Making PowerShell available on embedded devices
Windows Embedded Standard 2009 does not currently contain a componentized version of Windows PowerShell. However, one can still install PowerShell onto a Standard 2009 runtime image by satisfying a few dependencies. Below are some of the dependencies needed to satisfy the installation and the steps to install PowerShell.
Dependencies needed to satisfy PowerShell installation
To satisfy PowerShell installation, the following dependencies are necessary:
- .NET Framework 2.0 (or .NET Framework 3.x for PowerShell V2 CTP)
- Web Services for Management (WS-Management) and other additional requirements (as mentioned under “Installing PowerShell” section below) if installing PowerShell V2 CTP
Standard 2009 comes with a componentized version of .NET Framework 2.0. However, this may have some compatibility issue in installing and running PowerShell. I would recommend installing the desktop version of .NET Framework 2.0 or a more recent version. The additional requirements for installing PowerShell V2 CTP are not available on Standard 2009. Please refer to “Installing PowerShell” section below for more detail.
Steps to build Standard 2009 image and install PowerShell
The following steps provided are based on Standard 2009. In order to test remote management function, one would need to build two Standard 2009 images to run on two devices. The two images can be identical or different, as the second device does not need to support PowerShell installation. For the purpose of this exercise, we will use two Virtual PCs (VPCs) to emulate the two devices.
- On the development PC with Standard 2009 installed, invoke Target Designer and start a new configuration
- Add the components from the table below “Components to include in the VPC Configuration”, and also configure the settings as mentioned.
- Resolve all the dependencies for the components added into the configuration
- Build the image and make sure there is no error
- Optional – repeat all steps above to build an image for managed devices only
- Deploy the image(s) to two separate Virtual PCs (managing host and managed device) respectively
Components and their settings to include in the VPC Configuration:
.NET Framework 3.5 Setup
- Check “Install .NET Framework 3.5 Install Package during FBA”
Windows Management Instrumentation Technologies
- Check these individual components as minimum: WMI Core, WMI Correlation, WMI Filter, WMI Tools, WMI Win32 Provider
Windows Firewall Control Panel, Windows Firewall/Internet Connection Sharing (ICS)
- For Windows Firewall/Internet Connection Sharing (ICS), check "ICMP Settings: Allow incoming echo request"
Administrator Account
- Enter the administrator password if desired
Microsoft Management Console (MMC)
Group Policy Core Administration MMC Snap-In
COM+ Services
Virtual PC 2007 Helper Macro
The following are optional but highly recommended for testing and debugging:
- TCP/IP networking utilities
- TCP/IP Utilities
- Registry Editor
- Registry Editor
Installing PowerShell
After building and deploying the Standard 2009 images to the two individual VPCs, a following step would be to install PowerShell on one of the VPCs as a management host. The remote managed device does not need to have PowerShell installed.
Prior to installing PowerShell, please also make sure that .NET Framework 2.0 is installed. If the “Install .NET Framework 3.5 Install Package during FBA” is unchecked when building the Standard 2009 image, you may download the .NET Framework 2.0 installer package and install that first. Otherwise .NET Framework 3.5 would have been pre-installed in the image and it won’t be necessary to install .NET Framework 2.0.
For installing PowerShell V2 CTP, there are additional requirements:
- Web Services for Management (WS-Management 1.1)
- Windows Remote Management (WinRM 2.0 CTP) to use remote management features.
- .NET Framework 3.0 to use Graphical PowerShell and Out-GridView.
- The Get-Event cmdlet works only on Windows Vista and Windows Server 2008 and requires the Microsoft .NET Framework 3.5.
If the VPC has direct physical network access and internet connection, the PowerShell and other pre-requisite installer packages can be downloaded directly from Microsoft Download. Otherwise, they may be downloaded using the host PC and then somehow copied to the VPC.
Setting up the test environment
After deploying the two Standard 2009 images to the two separate Virtual PCs, one may need to setup a network connection between them and configure some firewall exceptions.
Setting up network communication between VPCs and/or Host PC
If the host PC is connected to a physical network with DHCP server, the easiest way to set up the network communication between the VPCs and/or host PC is to use the existing network adapter of the host PC. The Virtual Machine environment automatically provides a list of existing network adapters from the host PC. If a physical network is not available, an alternative is to setup a loopback network adapter. The following steps should be helpful in setting up a loopback network adapter.
- If the host PC is running Windows Vista, click on the ‘Start’ menu and select ‘Control Panel’, then ‘Add Hardware’ and ‘Network Adapter’. Or click on the ‘Start’ menu and select ‘Run’, type hdwwiz.cpl and hit ‘Enter’.
- By default, the Virtual Machine Network Services driver is enabled on the Loopback Adapter. One should be able to select Microsoft Loopback Adapter in the VPCs as one of the network settings
- Make sure that Firewall or Group Policy does not block the IP addresses.
- Firewall or group policy may block the default loopback adapter IP address range in 169.254.x.x. If so, re-configure the IP addresses to be in the range of 192.168.0.x to 192.168.1.254, or 10.0.x.x
Continuing on to remote management
Once you have successfully installed PowerShell on the managing host device, you can continue to part two of this article – configuring a remote device for management and some fun examples.
- Thomas
*Updated 3/9/09 - added link to Thomas' Bio.
Comments
Anonymous
March 13, 2009
Cannot find COM+ Services in Standard 2009. Can you provide a little more info on how to satisfy this requirement?Anonymous
March 14, 2009
The comment has been removed