Beruflich Dokumente
Kultur Dokumente
Agenda
Introduction to PowerShell
Within the Context of Management PowerShell Goals and Themes PowerShell 2.0
GUI over PowerShell (Demo) Production Scripting (Demo) Community Feedback
Todays IT Challenges
Increasing demands from the business
Reliance on technology for business-critical operations Always-available, anywhere
Increasing complexity
Adding capabilities adds management burden 80% of IT cost is managing existing systems
Server Migration
Known fact: most customers do not perform in-place upgrade Migration is a complex problem both from technical and process perspective WS7 pragmatic approach focus on understanding the problem and building foundation Goal: consistent documentation across all roles, Stretch: scriptable solution for core roles Lays foundation for more complete and richer solution in the future
Server Manager creates consistency and enables integration Goal: Further improve Server Manager, adding incremental value Key features: PS cmdlets to add/remove roles/features, remoting, Best Practice Analyzers Incubating next-gen UX Active Directory User Management
PowerShell
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
A taste of PowerShell
Using pkgmgr to install Web Server (IIS):
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IISStaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IISHttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET; IIS-NetFxExtensibility; IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IISHealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor; IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IISBasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IISClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication; IIS-URLAuthorization;IIS-RequestFiltering; IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IISHttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IISManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility; IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn; IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WASWindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
More Productivity
Exchange 2003 (VBScript)
Mailbox Statistics
Set listExchange_Mailboxs = GetObject("winmgmts:{impersonationLevel=impersonate}!\\COMPUTERNAME\ROOT\MicrosoftExch angeV2").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. LastLoggedOnUserAccount WScript.echo " LastLogoffTime = + objExchange_Mailbox. LastLogoffTime WScript.echo " LastLogonTime = + objExchange_Mailbox. LastLogonTime WScript.echo " LegacyDN = + objExchange_Mailbox. LegacyDN WScript.echo " MailboxDisplayName = + objExchange_Mailbox. MailboxDisplayName WScript.echo " MailboxGUID = + objExchange_Mailbox. MailboxGUID WScript.echo " ServerName = + objExchange_Mailbox. ServerName WScript.echo " Size = + objExchange_Mailbox. Size WScript.echo " StorageGroupName = + objExchange_Mailbox. StorageGroupName WScript.echo " StorageLimitInfo = + objExchange_Mailbox. StorageLimitInfo WScript.echo " StoreName = + objExchange_Mailbox. StoreName WScript.echo " TotalItems = + objExchange_Mailbox. TotalItems Next
E12 (PowerShell)
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)
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
Tower Of Power
PowerShell books
Now available in
Japanese German French More
2007
2008
Discovery
PowerShell V2 Goals
Reduce the cost and effort to:
Use PowerShell
Get, learn, share scripts
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)
PowerShell V2 Themes
GUI over PowerShell Production Scripting Universal Automation Environment Community Feedback
Datacenter Automation
PowerShell
GUI over PowerShell
Admin GUIs layered over PowerShell Features: Graphical PowerShell, Outgrid View, New Engine APIs, Runspace Pooling, Thread control
Server Role coverage:
AD Domain Services, AD Lightweight Directory Services, Application Server, Terminal Services, Web Server
Datacenter Automation
PowerShell
Production Scripting:
Scripts are easy to use, share and support and safe to operate Features: Script cmdlets, debugger enhancements, restricted language, modules and transactions
Features: Remoting, background jobs, eventing, restricted runspaces, mobile object model
PowerShell Architecture
User Experience
Shell
Engine
APIs
Managed Elements
Cmdlets WMI COM .NET XML ADO ADSI Native Commands
Language
Execution Context
Debugger
Object Mgr
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
Engine
APIs
Managed Elements
Cmdlets WMI COM .NET XML ADO ADSI Native Commands
Debugger
Thread Control
Object Mgr
PowerShell V2 Themes
Scripts are
Easy to use Safe to operate Easy to share Easy to support
Production Scripting
Engine
APIs
Managed Elements
Cmdlets Script Cmdlets WMI COM Native Code .NET XML ADO ADSI Native Commands
Debugger Enhancements
Language Restricted Execution Language Context
Modules
Debugger
Transactions
Object Mgr
Production Scripting
PowerShell V2 Themes
Respond to community feedback
Enhance the language Tweak the engine Add and enhance Cmdlets
Community Feedback
Engine
APIs
Managed Elements
Cmdlets WMI COM .NET
WMI++
ADO ADSI
XML
Debugger
PowerShellCommunity.org
Hal Rottenberg Title Company
PowerShellCommunity.org
Forums Blogs Script Repository User Group Outreach
PowerScripting Podcast
Hosts: Jonathan Walz & Hal Rottenberg Online at PowerScripting.net Weekly dose of News, Resources, Interviews, Tips and more!
PowerShell Newsgroup
Use NNTP server msnews.microsoft.com or web portal Group name: microsoft.public.windows.powershell
Microsoft Resources
PowerShell Team Blog blogs.msdn.com/powershell Scripting Guys Script Center microsoft.com/technet/scriptcenter
Hub for official documentation PowerShell Tip of the Week The Windows PowerShell Toolbox Script repository and other goodies
And You!
We need your participation If you blog about PowerShell, let us know! Get on the forums, newsgroups and chat
Engine
APIs
Managed Elements
Remoting
Cmdlets WMI COM .NET XML ADO ADSI Native Commands
Language
Execution Context
Restricted PSSessions
Debugger
Debugging:
Set-PSBreakpoint Get-PSBreakpoint
WMI:
Register-WMIEvent Set-WMIInstance Invoke-WMIMethod Remove-WMIObject
Enable-PSBreakpoint
Disable-PSBreakpoint Remove-PSBreakpoint Get-PSCallStack
More Cmdlets:
Clear-History Get-Random Out-GridView Set-StrictMode Update-List Wait-Process
Converting Types:
Add-Type ConvertTo-Csv ConvertFrom-Csv ConvertTo-Xml ConvertFrom-StringData
Eventing:
Register-ObjectEvent
Register-Event
Wait-Event Remove-Event Unregister-Event Get-Event New-Event
Computer
Add-Computer Checkpoint-Computer Disable-ComputerRestore Enable-ComputerRestore Get-ComputerRestorePoint Remove-Computer Rename-Computer Reset-ComputerMachinePassword Restart-Computer Restore-Computer Stop-Computer Test-ComputerSecureChannel
Script Internationalization:
Import-LocalizedData
Get-EventSubscriber
Modules:
Imort-Module Get-Module Remove-Module Export-ModuleMember
Background Jobs:
Start-Job Get-Job Stop-Job Receive-Job Wait-Job Remove-Job
Transactions:
Complete-Transaction Start-Transaction Undo-Transaction
Automation Overview
VM Data File
Validate Prerequisites
C:\VirtualMachines
Gold Image
= ..\TestVM30
= ..\TestVM49
More Info
Microsoft Alliance Page http://www.compellent.com/microsoft
Powershell
Compellent Powershell site http://www.compellent.com/powershell Command Set White Paper http://www.compellent.com/~/media/com/Files/White_Papers/CML_WPS_RR.ashx Windows Live Community Site http://compellentpowershell.groups.live.com/ Powershell Community.org http://www.powershellcommunity.org/ Powershell.com http://www.powershell.com
Summary
The investments in Windows Server 2008 R2 are a significant step towards increasing the manageability of the platform Expanded PowerShell - available on server core Remote-able
Community Resources
Newsgroup: Microsoft.Public.Windows.PowerShell Team blog: Channel 9 Wiki
http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki http://blogs.msdn.com/PowerShell/ http://www.PowershellCommunity.Org
PowerShellCommunity.Org:
http://channel9.msdn.com/tags/PowerShell
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/
Resources
www.microsoft.com/teched
Sessions On-Demand & Community
www.microsoft.com/learning
Microsoft Certification & Training Resources
http://microsoft.com/technet
Resources for IT Professionals
http://microsoft.com/msdn
Resources for Developers
Related Content
WSV402 Advanced Windows PowerShell Scripting
DAT314 Manageability Series: Microsoft SQL Server Automation on Steroids, Including PowerShell Support
SIA313 Managing Active Directory Identities with Active Directory PowerShell WSV325 Windows PowerShell: Tips from the Expert WCL314 Windows PowerShell for the Windows 7 Enterprise Client
2009 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.