Upload
clinton-stanard
View
219
Download
0
Tags:
Embed Size (px)
Citation preview
Using PowerShell to Create Manageable Web Services
Jeffrey SnoverPartner ArchitectMicrosoft Corporation
ES24
Deliver great management (cheaply)? Satisfy the full range of Admins? Automate operation of LOTS of
heterogeneous stuff (including raw HW)? Enable users to SAFELY do their own
management? Integrate into my customer’s
management system?
When Building A WS, How Do I…?
PowerShell V1 PowerShell V2 Managing
Raw Hardware and other OSes Single Machines Sets of Machines
Scalable remote administration
Agenda
Windows PowerShellNew command-line shell and scripting language
• 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
Universal Automation Environment
Automation FrameworksAutomation Frameworks
Automation Frameworks
Cmdlets
In-Proc, Local, RemoteRuntime Engines
In-Proc, Local, RemoteRuntime Engines
In-Proc, Local, RemoteRuntime Engines
Automation Platform (API)
ScriptingLanguage
Type Normalizers
Type Normalizers
Type Normalizers
Providers Events, Jobs, Transactions
Shells, ISEs, GUI s, Applications Universal• Interactive or programmatic• Wide range of OSes• Local or Remote• Single or Multi Machine• Synch or Asynch• Wide range of authentication mechanisms• .NET, native code, COM, WMI, ADSI, XML, ADO, WebServices, WSMAN, etc• Simple scripting to systems programming
Powered by a strong community
Writing Cmdlets
Demo
PowerShell V2 Goals
Reduce the cost and effort to: Use PowerShell
Get, learn, share scripts Layer applications on PowerShell
GUI, web, workflow, etc. Manage anything/everything
Servers, clients, distributed systems, applications, web services, cloud services, raw HW, other OSes, everything
Using any and all mechanisms (WMI, .Net, native code, web services, WSMAN)
Who Does What?V1 V2
Developer •Cmdlets and/or providers• Help
•PowerShell cmdlets •Transaction support
PowerShell • CLI & API
• Rich language w/access to com, wmi, .Net, adsi, xml & ado
• Utilities to manipulate, format, import/export
• 129 Cmdlets
•Web service & workflow activities
•Richer language w/access to web services, unmanaged code, wsman
• Richer utilities including eventing, job control, remote execution
• 241 Cmdlets
•Graphical ISE to create/debug scripts
Users •Simple ad hoc scripts•Sophisticated production scripting
•Systems programming•Across multiple machines
Community • Write and share scripts • Write and Share Modules
V1 Scripts and Cmdlets run on PowerShell V2
PowerShell V2 in Windows 7PowerShell V2 in Server Core
Announcing
Managing Raw HW and Other OSes
Management initiative driven by DMTF Platform independent, interoperable & industry
standard management solution CIM based standards for Server and Desktop management WS-Management (WSMAN)
ITConsole
ManagedPlatforms
WSMAN
Raw HW Management - Examples
Power control and boot control HW/ SW inventory Alerts and lifecycle events Config/manage BIOS Software and Firmware update Health monitoring
Hardware Sample Commands
Power Off Command
Invoke-WSManAction -CN $svr -cred $cred -port 16992 `-Auth digest CIM_ComputerSystem `–Action RequestStateChange `–SelectorSet @{Name="ManagedSystem"} `-valueSet @{RequestedState="3"}
Chassis Class Get-WSManInstance -CN $svr -cred $cred -port 16992 -Auth digest -enum CIM_Chassis
Chip Class Get-WSManInstance –CN $srv -cred $cred -port 16992 -Auth digest -enum CIM_Chip
Power On Command
Invoke-WSManAction -CN $svr -cred $cred -port 16992 `-Auth digest CIM_ComputerSystem `–Action RequestStateChange `–SelectorSet @{Name="ManagedSystem"} `-valueSet @{RequestedState=“2"}
Managing Raw Hardware & Other OSes
Demo
Fine Grain Control For Working Across The Web
New-WSManSessionOption [-NoEncryption ] [-OperationTimeout <0->] [-ProxyAccessType <ProxyAutoDetect | ProxyIEConfig |
ProxyNoProxyServer | ProxyWinHttpConfig>] [-ProxyAuthentication <Basic | Digest | Negotiate>] [-ProxyCredential <PSCredential>] [-SkipCACheck ] [-SkipCNCheck ] [-SkipRevocationCheck ] [-SPNPort <0->] [-UseUTF16 ]
Managing Single Machines
Remote WMI Remote Command/Script Execution Remote Background Jobs Remote Interactive Session BITS
BITS
Background Intelligent
Utilizes only idle network bandwidth. Throttles usage to preserve the user’s interactive experience.
Admin schedulable bandwidth usage limits Prioritized transfers Peer Caching Resumable
Transfer HTTP/HTTPS & SMB downloads/uploads
Used by over 600 million users worldwide
Managing Single Machines
Demo
WMI -ComputerName <string[]> -Throttle <int> -AsJob
PS> gwmi -CN (cat servers.txt) Win32_Bios -Throttle 64 | Select __Server, Name, Manufacturer, Version | ConvertTo-Html > BiosInventory.htm
PS> $job = gwmi -CN (cat servers.txt) Win32_Bios -Throttle 64 –AsJob PS> Wait-job $j # or go do something else PS> Receive-Job $j |
Select __Server, Name, Manufacturer, Version | ConvertTo-Html > BiosInventory.htm
Managing Sets Of Machines
Invoke-Command can run expressions, commands and/or ScriptBlocks In the foreground or background
-AsJob On one or more machines
-ComputerName <string[]> Over a LAN or a WAN
-SessionOption <SessionOption> In restricted or unrestricted environments
- -ConfigurationName <String> Using short or long connections
-Session <RemoteRunspaceInfo[]> Using impersonation or supplied credentials
-Credentials
Register-PSEvent –Action <ScriptBlock>
Managing Sets Of Machines
Customer admin experience across the Web Different customers & different roles
Access different commands Have different options on the same commands
Interactive & scripting On-the-fly generation of
“virtual” commands
Scalable Remote Administration
New ISS extension module: WSMAN WSMan plugin – PowerShell
Exposes a Resource URI Creates a new Session for every user running
on an impersonated thread Startup script configures the Session
Language: Full, Restricted, None Commands External applications Scripts Providers
Details
Company1
[email protected] [email protected]
SMB2
[email protected] [email protected]
WW
Hosting Service – Data Farm
CoolLabs.com
SMB2
WW
W
Runspace [email protected]
Runspace [email protected]
[email protected] [email protected]
Company1
[email protected]@Company2.com
Scalable Remote Administration
Demo
Remote Programming
Demo
Deliver great management (cheaply)? Satisfy the full range of Admins? Automate operation of LOTS of
heterogeneous stuff (including raw HW)? Enable users to SAFELY do their own
management?
When Building A WS, How Do I…?
Windows PowerShell V2
Q&A
Evals & Recordings
Please fill
out your
evaluation for
this session at:
This session will be available as a recording at:
www.microsoftpdc.com
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.