Using Windows Power Shell on Windows Embedded Standard
Using Windows Power. Shell on Windows Embedded Standard Alexander Wechsler Enterprise Architect|CEO Microsoft Regional Director Germany|e. MVP Wechsler Consulting GMBH & Co. KG EMB 306
Disclaimer Everything you will hear in this session is experimental and should be taken that way! There is no support from Microsoft for this! Testing is up to you! -> well, if that is news to you…
Windows Power. Shell New command line and scripting language As interactive and composable as BASH/KSH As programmatic as Perl/Python/Ruby As production oriented as AS 400 CL/VMS DCL Allows access to data stores as easy to access as filesystem
State of the Software Phenomenal rate of adoption Over 2 million downloads in less than 18 months Power. Shell Downloads 2, 5 Windows XP, Windows Vista, Windows Server 2003 and 2008 Shipped with Windows Server 2008 2 Adopted by Exchange, SQL, SCOM, SCVMM, and SCDPM Millions 1, 5 1 CEC 2009 requirement 0, 5 Dozens of 3 rd party tools, ISVs, and partners 0 в 0 7 8 р0 ма 8 ян 07 7 07 я 0 но н се л ию 7 й 0 ма р0 ма 7 в 0 ян 6 я 0 но Strong community engagement, 27 Power. Shell MVPs
The Difference is OBJECTS! Get-Process Where { $_. handles –gt 500 } Sort handles Format. Table Common Windows Power. Shell Parser Get. Process Cmdlet Where Cmdlet Sort Cmdlet Format Cmdlet Windows Power. Shell Pipeline Processor
Power. Shell Architecture User Experience Engine Managed Elements Cmdlets Shell APIs WMI COM Language Execution Context . NET XML ADO Debugger Object Mgr ADSI Native Commands
Power. Shell V 2 Themes Admin GUIs layer on top of Power. Shell CLI & GUI Agility in delivering new GUIs Ensures automation GUI teaches command line Standardizes access to managed elements GUI over Power. Shell
Power. Shell V 2 Themes Scripts are Easy to use Safe to operate Easy to share Easy to support Production Scripting
Power. Shell V 2 Themes Expressions, Commands, and Script. Blocks can run In the foreground or background On one or more machines Over a LAN or a WAN In restricted or unrestricted environments Using impersonation or supplied credentials Initiated by user input or by events Universal Code Execution Model
Demo Power of Power. Shell
Why use Power. Shell on Windows Embedded? Change management is always a challenge Build time Factory floor In-field maintenance Operating system deployment Commonly known tools Show their age -> CMD. exe / batch files Are good, but limited to their environment –> WSH Are not comfortable to use -> DUA Are moving towards Power. Shell -> SCCM!
Embedded Scenarios 1/2 Build process Post FBA image configuration Image sealing Factory Target Device Configuration Computer name Domain join Etc. HW and SW test/quality assurance
Embedded Scenarios 2/2 Field Adjusting user experience (desktop or shell settings) Network configuration IP-Settings Network Share Firewall Handling of disk filters/HORM Remote Management of devices Device detection WES Power Management
Getting Power. Shell into a WES Image 1/2 Version 1. 0 Required. NET Framework 2. 0 Web Services for Management (WS-Management) Optional Additional infrastructure targeted, e. g. : WMI EWF /FBWF manager console application
Getting Power. Shell into a WES Image 2/2 Version 2. 0 CTP Required. NET Framework 3. 0 or higher setup Web Services for Management (WS-Management) Optional Windows Management Instrumentation Technologies Windows Firewall Control Panel, Windows Firewall/Internet Connection Sharing (ICS) Administrator Account (with password) Microsoft Management Console (MMC) Group Policy Core Administration MMC Snap-In COM+ Services Write Filter Console Applications
Adding Windows Power. Shell Manual Add required/desired components from the WES catalog to the image Run through FBA Run Power. Shell installation manually Automatic Add required/desired components from the WES catalog Create silent setup components out of: Power. Shell Installer X 86 Web Services for Management (WS-Management 1. 1)
Demo Creating Silent Setup Components
Demo Windows Embedded Standard Image with Power. Shell Version 2. 0 CTP
Real World Examples 1/3 Build process Add custom configurations Add Boot Logo switch Change wallpaper Turn on EWF
Demo Build Process Samples
Real World Examples 2/3 Factory Check for image errors List installed applications List installed drivers Change computer name Read configuration from XML file Change name Reboot
Demo Factory Samples
Real World Examples 3/3 Field Enhancing DUA with Power. Shell Using Power. Shell as DUA IDE Static network settings using WMI Enhancing user experience Device detection
Device Update Agent Architecture Development Environment Update Web Server Device Update Script (. DUS file) Translator Command File (. DUP) HTTP/HTTPS Validate and Tokenize XPE Device Update Agent Local File Storage
Device Update Agent Configuration
Demo Field Samples
Remote Management with Power. Shell Current limitation WS-Management not supported in WES 2009 WMI Remote Management supported Target computer does not need to have Power. Shell WMI infrastructure required Special DCOM configuration essential
Demo Remote Management with WMI
Advanced Power. Shell Usage 1/3 Writing custom Cmdlets Great way to extend the language e. g. : “Start-EWF”, “Get-Sensors”, “Get-Robots” Use. NET Interop to reach out to native APIs [Cmdlet(Verbs. Lifecycle. Start, "EWF“, Default. Parameter. Set. Name = “Volume“, Supports. Should. Process = true)] public class Start. EWFCommand : PSCmdlet { …. . Implement EWF functionality here }
Hosting the Power. Shell Runtime …… using System. Management. Automation; using System. Management. Automation. Host; using System. Management. Automation. Runspaces; namespace Microsoft. Samples. Power. Shell. Host { class Host 01 {. . . . /// <param name="args">Unused</param> static void Main(string[] args) { // Create an instance of this class so that the Power. Shell // will have access to the Should. Exit and Exit. Code // parameters. Host 01 me = new Host 01(); // Create the host instance to use. My. Host my. Host = new My. Host(me); // Create and open the runspace, passing the host // instance just created. Runspace my. Run. Space = Runspace. Factory. Create. Runspace(my. Host); my. Run. Space. Open(); // Create the invoker and use it to execute the script. Runspace. Invoke invoker = new Runspace. Invoke(my. Run. Space); string script = “write-host ‘Hello World!’” invoker. Invoke(script); . .
Advanced Power. Shell Usage 2/3 Host the Power. Shell runtime Get scripting capabilities for your application Enhance a custom shell Create a Power. Shell provider for your application or Shell Power. Shell-enable your code /application Find the Powershell SDK at: http: //msdn. microsoft. com/en-us/library/ms 714469(VS. 85). aspx
Advanced Power. Shell Usage 3/3 Use Power. Shell in Deployment and Maintenance System Center Configuration Manager Windows Server Update Services Windows Deployment Services Not available on Win. PE (no. NET support)
Power. Shell. Community. org Forums Cmdlet Library Blogs Wiki Script Repository Software Directory User Group Outreach
Microsoft Resources Windows Embedded Team Blog http: //blogs. msdn. com/embedded/ Power. Shell Team Blog blogs. msdn. com/powershell Scripting Guys Script Center microsoft. com/technet/scriptcenter Hub for official documentation The Windows Power. Shell Toolbox Script repository and other goodies
Question & Answer
Breakout Sessions General EMB 202: What a desktop developer needs to know to develop for Windows Embedded EMB 304: Windows Embedded: from sensors to servers EMB 310: Windows Embedded: "Demos only“ Windows Embedded CE EMB 301: Technical introduction to the new Windows Embedded CE 6. 0 R 3 EMB 307: Windows Embedded CE 6. 0: Tools and Techniques to Face the Embedded Development Challenges EMB 201: Windows Embedded CE and Connectivity EMB 305: From Expression Blend to Windows Embedded CE: build the UI of next generation devices Windows Embedded Standard and POSReady EMB 303: Windows Embedded Standard 2011: How to Embed Windows 7 into Devices EMB 309: Create a Multitouch and Gesture Aware Device Using Windows Embedded Standard 2011 EMB 308: Componentization Architecture in Windows Embedded Standard 2011 EMB 306: Using Windows Power. Shell on Windows Embedded Standard EMB 302: Deploying Windows Embedded with Style EMB 203: Using Windows Deployment Services And Microsoft System Center To Deploy And Manage A Point-of-Service (POS)
HOLs, Interactive, Sunday and Demo Sessions Interactive sessions EMB 01 -IS: Delivering Applications as Appliances EMB 02 -IS: Windows for Devices: Learn about the Future of Windows Embedded EMB 03 -IS: The Schtick: Solving Real-Time Challenges, connectivity and GUI with Windows Embedded CE EMB 04 -IS: Deploying and maintaining Windows Embedded Standard with different Hands On Lab Higher Fidelity internet experience with Internet Explorer Embedded Introduction to Connection Manager Creating a custom Windows Embedded Standard 2011 operating system image for an application New Servicing and Deployment Scenarios in Windows Embedded Standard 2011 Embedded Enabling Features in Windows Embedded Standard 2011 Configuring and Using Power. Shell to Manage Windows Embedded Standard 2011 Devices Sunday and Demo Session EMB 101 -SUN: Windows Embedded 101 EMB 01 -Demo: Embedding Windows Seven into devices
Useful URLs Microsoft Web sites http: //windowsembedded. com http: //msdn. microsoft. com/en-us/windowsembedded/ce/default. aspx http: //msdn. microsoft. com/en-us/windowsembedded/standard/default. aspx http: //technet. microsoft. com/en-us/windowsembedded/posready/default. aspx Blogs http: //blogs. msdn. com/obloch http: //blogs. msdn. com/mikehall http: //blogs. msdn. com/jcoyne Other http: //www. wechsler-consulting. de http: //windowsfordevices
Complete an evaluation on Comm. Net and enter to win an Xbox 360 Elite!
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U. S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
- Slides: 41