Alexander Wechsler
Enterprise Architect|CEO
Microsoft Regional Director Germany|eMVP
Wechsler Consulting GMBH & Co. KG
Session Code: WEM
304
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…
No risk, not fun!
As
interactive
and
composable
as BASH/KSH
As
programmatic
as Perl/Python/Ruby
As
production oriented
as
AS400 CL/VMS DCL
Allows access to data stores as
easy
to access as filesystem
Windows PowerShell
New command line and
scripting language
State of the Software
Phenomenal rate of adoption
Over 2 million downloads in
less than 18 months
Windows XP, Windows Vista,
Windows Server 2003 and 2008
Adopted by Exchange, SQL, SCOM,
SCVMM, and SCDPM
CEC 2009 requirement
Dozens of 3
rd
party tools,
ISVs, and partners
Strong community engagement,
27 PowerShell MVPs
0
0.5
1
1.5
2
2.5
PowerShell Downloads
Millions
Shipped with
Windows Server 2008
The Difference is OBJECTS!
Get
-
Process
Where
{ $_.handles
–
gt 500 }
Sort
handles
Format
-
Table
Common Windows PowerShell Parser
Windows PowerShell Pipeline Processor
Get
-
Process
Cmdlet
Sort
Cmdlet
Where
Cmdlet
Format
Cmdlet
PowerShell Architecture
User
Experience
Engine
Managed
Elements
Shell
Language
Debugger
APIs
Execution Context
Object Mgr
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Native Commands
PowerShell V2 Themes
Admin GUIs layer on top of PowerShell
CLI & GUI
Agility in delivering new GUIs
Ensures automation
GUI teaches command line
Standardizes access to managed elements
GUI over PowerShell
PowerShell V2 Themes
Scripts are
Easy to use
Safe to operate
Easy to share
Easy to support
Production Scripting
PowerShell V2 Themes
Expressions, Commands, and ScriptBlocks can run
In the foreground or background
On one or more machines
Over a LAN or a WAN
In restricted or unrestricted environments
Universal Code Execution Model
Using impersonation or supplied credentials
Initiated by user input or by events
Power of PowerShell
Why use
PowerShell
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
PowerShell
-
> 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
(Standard or custom providers)
Device detection
WES Power Management
Getting
PowerShell
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
PowerShell
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 PowerShell
Manual
Add required/desired components from the WES catalog to the
image
Run through FBA
Run
PowerShell
installation manually
Automatic
Add required/desired components from the WES catalog
Create silent setup components out of:
PowerShell
Installer X86
Web Services for Management
(
WS
-
Management 1.1
)
Creating Silent Setup Components
Windows Embedded Standard Image
with PowerShell Version 2.0 CTP
Real World Examples 1/3
Build process
Add custom configurations
Add Boot Logo switch
Change wallpaper
Turn on EWF
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
Factory Samples
Real World Examples 3/3
Field
Enhancing DUA with PowerShell
Using PowerShell as DUA IDE
Static network settings using WMI
Enhancing user experience
Device detection
Development Environment
Validate
and
Tokenize
Device Update Agent
Architecture
XPE Device
Device
Update
Script
(.DUS file)
Translator
Command
File (.DUP)
Device Update Agent
Local
File Storage
HTTP/HTTPS
Update
Web Server
Device Update Agent Configuration
Field Samples
Remote Management with
PowerShell
Current limitation
WS
-
Management not supported in WES 2009
WMI Remote Management supported
Target computer does not need to have
PowerShell
WMI infrastructure required
Special DCOM configuration essential
Remote Management with WMI
Advanced PowerShell 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
(
VerbsLifecycle.Start
, "EWF“,
DefaultParameterSetName
= “Volume“,
SupportsShouldProcess
= true)]
public class
StartEWFCommand
:
PSCmdlet
{
…..Implement EWF functionality here
}
Hosting the PowerShell Runtime
……
using
System.Management.Automation
;
using
System.Management.Automation.Host
;
using
System.Management.Automation.Runspaces
;
namespace
Microsoft.Samples.PowerShell.Host
{
class Host01
{ .......
/// <
param
name="
args
">Unused</
param
>
static void Main(string[]
args
)
{
// Create an instance of this class so that the PowerShell
// will have access to the
ShouldExit
and
ExitCode
// parameters.
Host01 me = new Host01();
// Create the host instance to use.
MyHost
myHost
= new
MyHost
(me);
// Create and open the
runspace
, passing the host
// instance just created.
Runspace
myRunSpace
=
RunspaceFactory.CreateRunspace
(
myHost
);
myRunSpace.Open
();
// Create the invoker and use it to execute the script.
RunspaceInvoke
invoker = new
RunspaceInvoke
(
myRunSpace
);
string script = “write
-
host ‘Hello World!’”
invoker.Invoke
(script);
.........
}
}
Advanced PowerShell Usage 2/3
Host the
PowerShell
runtime
Get scripting capabilities for your application
Enhance a custom shell
Create a
PowerShell
provider for your
application or Shell
PowerShell
-
enable your code /application
Find the
Powershell
SDK at:
http://msdn.microsoft.com/
en
-
us/library/ms714469(VS.85).
aspx
Advanced PowerShell Usage 3/3
Use
PowerShell
in Deployment
and Maintenance
System Center Configuration Manager
Windows Server Update Services
Windows Deployment Services
Not available on
WinPE
(no .NET support)
Forums
Cmdlet Library
Blogs
Wiki
Script Repository
Software Directory
User Group Outreach
PowerShellCommunity.org
Microsoft Resources
Windows Embedded Team Blog
http://blogs.msdn.com/embedded/
PowerShell
Team Blog
blogs.msdn.com/
powershell
Scripting Guys Script Center
microsoft.com/
technet
/
scriptcenter
Hub for official documentation
The Windows
PowerShell
Toolbox
Script repository and other goodies
Related Content
Breakout Sessions
WEM203
Leveraging the Windows Presentation Framework in Windows Embedded Standard
"Quebec"
WEM301
Windows Embedded and Industrial Solutions: From Sensors to Servers
WEM 206
Building Thin Clients with Windows Embedded
WEM303
Deploying Windows Embedded Standard 2009 with Style
Required Slide
Speakers,
please list the
Breakout Sessions,
TLC Interactive
Theaters and Labs
that are related to
your session.
WEM205
Using Windows Deployment Services And Microsoft System Center To Deploy And
Manage A Point
-
of
-
Service (POS) System Running POSReady
Windows Embedded Resources
Website:
www.windowsembedded.com
Social Channels:
blogs.msdn.com/mikehall
b
logs.msdn.com/
obloch
Technical Resources:
http://msdn.microsoft.com/embedded
Tools evaluations:
www.windowsembedded.com/downloads
Required Slide
Track PMs
will
supply the content
for this slide,
which will be
inserted during
the final scrub.
www.microsoft.com/teched
Sessions On
-
Demand & Community
http://microsoft.com/technet
Resources for IT Professionals
http://microsoft.com/msdn
Resources for Developers
www.microsoft.com/learning
Microsoft Certification and Training
R
esources
www.microsoft.com/learning
Microsoft Certification & Training Resources
Resources
Required Slide
Speakers,
TechEd 2009 is not
producing
a DVD. Please
announce that
attendees can
access
session
recordings at TechEd
Online.
Complete an
evaluation on
CommNet and
enter to win!
Required Slide
©
2009 Microsoft
Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademar
ks
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
dat
e 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 informatio
n p
rovided after the date of this presentation.
MICROSOFT
MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Required Slide
Enter the password to open this PDF file:
File name:
-
File size:
-
Title:
-
Author:
-
Subject:
-
Keywords:
-
Creation Date:
-
Modification Date:
-
Creator:
-
PDF Producer:
-
PDF Version:
-
Page Count:
-
Preparing document for printing…
0%
Comments 0
Log in to post a comment