Partner Architect Agenda Past Present Future UNIX Composable Management A B C The heart of Unix composable management Means that A didnt do what you wanted to do WHY A is a tight coupling of ID: 797971
Download The PPT/PDF document "PowerShell Jeffrey P. Snover" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
PowerShell
Jeffrey P. Snover
Partner Architect
Slide2Agenda
Past
Present
Future
Slide3UNIX Composable
Management
A | B | C
The heart of Unix
composable
managementMeans that A didn’t do what you wanted to doWHY?A is a tight coupling ofGet Objects => Process Objects => Output as text“| B | C” uses prayer-based parsing to recreate the object so you can do one of the steps differently.NET allows us to do betterPipeline structured objects instead of textPipeline should be between get/process/Output
Successful but very inefficient
Slide4Composable Data Model Progression
UNIX:
Standardized data encoding (ASCII files) allows the emergence of a set of domain-neutral utilities for composition and manipulation (e.g.
sed
,
awk, grep)SQL: Standardized data forms (Tables) allow the emergence of a set of domain-neutral utilities for composition and manipulation (e.g. join, query, groupby).NET Reflection:
Standardized object forms (
.net
objects) allow the emergence of a set of domain-neutral
utilities
for composition and manipulation
PowerShell Dynamic objects
.Net
Reflection model applied to XML, WMI, ADSI, ADO, etc
Extended types to ease composition, organize folklore, and facilitate discovery
Slide5# of
commands
Delivered
Traditional
Model
Common
Engine, Language
& Utilities
Individual
Cmds
Common Functions
Economics for Developers
Dev
Costs
Test Costs
User Training
Slide6Present: Windows PowerShell
New 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
Slide7Demo: Short Introduction
Jeffrey P. Snover
Partner Architect
Slide8The Difference is OBJECTS!
Get-Process | Where { $_.handles –
gt
500 } | Sort handles | Format-Table
Get-Process
Cmdlet
Common Windows PowerShell Parser
Windows PowerShell Pipeline Processor
Where
Cmdlet
Sort
Cmdlet
Format
Cmdlet
Slide9PowerShell
Engine
Exchange cmdlets
Configuration Data Access
AD
Registry
Meta
base
MAPI
Store
Process
boundary
E2007Management Architecture
Early-bound objs
WinForms
ADO.Net
PowerShell
Data Provider
WinForms
CLI
GUI
Setup
Slide10Forms of Scripting
Scripts
Filters
Functions
Script Cmdlets [New in V2]
Slide11Styles of Scripting
Ad Hoc
Run at the command line
Simple BASH style
Parameters are not named or typed
FormalParameters are named, typed, have initializersSophisticatedRich error handlingSupport –Verbose, -Debug, -Confirm, -WhatifDigitally signed
Slide12Styles of Scripting
Jeffrey Snover
Windows Management Partner Architect
demo
Slide13Agenda
Past
Present
Future
Slide14State 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 SCDPMCEC 2009 requirementDozens of 3
rd
party tools, ISVs, and partners
Citrix,
VMWare
,
Websphere
, etc
Strong community engagement, 27 PowerShell MVPs
Shipped with
Windows Server 2008
Slide15Tower Of Power
PowerShell books
Now available in
Japanese
German
FrenchMore…2007
2008
Slide16Productivity
Exchange 2003 (VBScript)
E12 (Monad Script)
Mailbox Statistics
Set
listExchange_Mailboxs
=
GetObject
("
winmgmts
:{
impersonationLevel
=impersonate}!\\COMPUTERNAME\ROOT\MicrosoftExchangeV2").
InstancesOf
("
Exchange_Mailbox
")
For Each
objExchange_Mailbox
in
listExchange_Mailboxs
WScript.echo
"
AssocContentCount
=” +
objExchange_Mailbox.AssocContentCount
WScript.echo
"
DateDiscoveredAbsentInDS
=” +
objExchange_Mailbox.DateDiscoveredAbsentInDS
WScript.echo
"
DeletedMessageSizeExtended
=” +
objExchange_Mailbox
.
DeletedMessageSizeExtended
WScript.echo
"
LastLoggedOnUserAccount =” + objExchange_Mailbox
. LastLoggedOnUserAccountWScript.echo " LastLogoffTime =” + objExchange_Mailbox.
LastLogoffTimeWScript.echo " LastLogonTime =” + objExchange_Mailbox.
LastLogonTime WScript.echo " LegacyDN =” + objExchange_Mailbox
. LegacyDNWScript.echo " MailboxDisplayName =” + objExchange_Mailbox
. MailboxDisplayNameWScript.echo " MailboxGUID =” + objExchange_Mailbox
.
MailboxGUID
WScript.echo " ServerName =” +
objExchange_Mailbox. ServerName
WScript.echo " Size =” + objExchange_Mailbox
. SizeWScript.echo "
StorageGroupName =” + objExchange_Mailbox.
StorageGroupName
WScript.echo
"
StorageLimitInfo
=” +
objExchange_Mailbox
.
StorageLimitInfo
WScript.echo
"
StoreName
=” +
objExchange_Mailbox
.
StoreName
WScript.echo
"
TotalItems
=” +
objExchange_Mailbox
.
TotalItems
Next
get-
mailboxstatistics
–server $
servername
Database Mgmt
Dim StorGroup as New CDOEXM.StorageGroup
StorGroup.DataSource.Open "LDAP://" + DCServer + "/ CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName
StorGroup.MoveLogFiles("C:\newlogPath", 0)
move-
storagegrouppath
-identity “First Storage
Group“
–log "C:\newlogPath”
Recipient Mgmt
Dim objMailbox As CDOEXM.IMailboxStore
Set objMailbox = GetObject("LDAP://" + DCServer + "CN=FOO,CN=users," + DomainName)
objMailbox.CreateMailbox "LDAP://" + DCServer + "/CN=Private MDB,CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName
enable-mailbox
-identity domain\FOO
–database “First Storage
Group\Private MDB”
Slide17Agenda
Past
Present
Future
Slide18PowerShell Architecture
Slide19PowerShell V2 Themes
Slide20PowerShell V2 Themes
Admin GUIs layer on top of PowerShell
CLI
&
GUI
Agility in delivering new GUIsEnsures automationGUI teaches command lineStandardizes access to managed elements
Slide21GUI Over PS: Features
Graphical PowerShell
Out-
Gridview
New APIs
Runspace
Pooling
Thread Control
Slide22GUI Over PowerShell
DEMO
PowerShell V2 Themes
Scripts are
Easy to use
Safe
to operate
Easy to shareEasy to support
Slide24Production Scripting: Features
Script Cmdlets
Data Language
Modules
Debugger Enhancements
Transactions
Script Cmdlets
Native Code
Slide25Production Scripting
Jeffrey
Snover
Partner Architect
MSD Solutions and Platforms
DEMO
Slide26PowerShell 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 environmentsUsing short or long connectionsUsing impersonation or supplied credentialsInitiated by user input or by events
Slide27UCCE Features
Remoting
Background Jobs
Eventing
Restricted
Runspaces
Mobile Object Model
Slide28Mobile Objects Model
Islands of optimization in a sea of interoperability
Whenever possible, use live .NET objects
Use typed property bags everywhere else
Live objects get serialized at runspace borders
Typed property bags using 22+ core datatypesEverything else is converted using ToString()Process can be tweaked with typeXML entriesAutomatically deserialized into typed property bags on receiptType:
Deserialized.OriginalType
PSComputerName
Slide29Universal Code Execution
Jeffrey Snover
Partner Architect
MSD Solutions and Platforms
DEMO
PowerShell V2 Themes
Respond to community feedback
Enhance the language
Tweak the engine
Add and enhance Cmdlets
Slide31Community Feedback: Features
Language Enhancements
Improved
Object
Adapters
New Cmdlets
WMI++
Slide32New Cmdlets (So Far)
Remoting
:
Invoke-Command
New-
RunspaceGet-RunspacePush-RunspacePop-RunspaceRemove-RunspaceConverting Types:
Add-Type
ConvertTo-Csv
ConvertFrom-Csv
ConvertTo
-Xml
ConvertFrom-StringData
Event Viewer and ETW Logs:
Get-Event
Script Internationalization:Import-LocalizedDataModules:Add-ModuleGet-ModuleRemove-ModuleExport-ModuleMember
Debugging:
Set-
PSBreakpoint
Get-
PSBreakpoint
Enable-
PSBreakpoint
Disable-
PSBreakpoint
Remove-
PSBreakpoint
Get-
PSCallStack
Eventing
:
Register-
ObjectEvent
Register-
PSEvent
Wait-
PSEvent
Remove-
PSEvent
Unregister-PSEvent Get-PSEvent
New-PSEventGet-PSEventSubscriber
Background Jobs:Start-PSJob
Get-PsJobStop-PSJob
Receive-PSJobWait-PSJob
Remove-PSJob
Transactions:
Complete-
PSTransaction
Start-PSTransaction
Undo-
PSTransaction
Use-PSTransaction
WMI:
Register-
WMIEvent
Set-
WMIInstance
Invoke-
WMIMethod
Remove-
WMIObject
More Cmdlets:
Clear-History
Get-Random
Out-
GridView
Set-
StrictMode
Update-List
Wait-Process
Slide33WMI+++
Cmdlets
Get-
WmiObject
, Remove-
WmiObjectSet-WMIInstanceInvoke-WmiMethodRegister-WMIEventNew parameters -Impersonation, -Authentication, -Locale,
-
EnableAllPrivileges
, -Amended, -
DirectRead
,
-Authority
-
AsJob and -ThrottleLimit (!)Connection settings stay with the object [bug fix]
Slide34Community Resources
Newsgroup:
Microsoft.Public.Windows.PowerShell
Team blog:
http://blogs.msdn.com/PowerShell/
PowerShellCommunity.Org
:
http://www.PowershellCommunity.Org
Channel 9
http://channel9.msdn.com/tags/PowerShell
Wiki
http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki
Script Center:
http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
CodePlex
:
http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershell
Many excellent books
Manning Press book by PowerShell Dev Lead Bruce Payette:
PowerShell in Action
http://manning.com/powershell/
O’Reilly book by PowerShell Dev Lee Holmes –
Windows PowerShell Cookbook
http://www.oreilly.com/catalog/9780596528492/index.html
Slide35Questions?
http://blogs.msdn.com/powershell
Slide36©
2007
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.