Sie sind auf Seite 1von 47

Dan Reger Sr.

Product Manager Microsoft WSV319

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

Interlude - PowerShellCommunity.org PowerShell 2.0 (continued)


Universal Automation Environment

Demo Compellent Technologies

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

Trends of the future magnify challenges


Move to Datacenters large scale, virtualization remote management Outsourcing lower skilled, high turnover users

Windows Server 2008 R2


Streamlined Management Scenarios
Datacenter Automation
PowerShell: Universal Code Execution Model, GUI over PowerShell, Production Scripting WMI: Discoverability through PS, Profile discovery, CIM update WS-Man: Remote Shell, Support for hosted environments (Web proxy traversal, Federated Auth using Live ID), Hardware Management (out-of-band management in-band with OS), Resource management BITS: Lightweight server PS cmdlets across all!

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

Rich Server Management

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

Server Manager & PowerShell Integration


Server Manager PowerShell Cmdlets:
Get-WindowsFeature Add-WindowsFeature Remove-WindowsFeature

Leverages PowerShell features/reach


Richer command line experience (auto-completion, wildcards, object pipeline, etc) Remoting Availability on Server Core

PowerShell

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

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

Or using Server Manager:


Add-WindowsFeature web-server OR servermanagercmd install web-server

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)

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

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

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)

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

Universal Code Execution Model:


Flexibility over where/how expressions, Commands & ScriptBlocks can run
On one or more machines In restricted or unrestricted environments Initiated by user input or by events

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

GUI over PowerShell

GUI Over PowerShell: Features


User Experience
Graphical PowerShell Shell Out-Gridview
Language

Engine
APIs

Managed Elements
Cmdlets WMI COM .NET XML ADO ADSI Native Commands

New Context ExecutionAPIs


PSSession Pooling

Debugger

Thread Control

Object Mgr

GUI Over PowerShell

PowerShell V2 Themes
Scripts are
Easy to use Safe to operate Easy to share Easy to support

Production Scripting

Production Scripting: Features


User Experience
Script Cmdlets
Shell

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

Community Feedback: Features


User Experience
Language Shell Enhancements
Language

Engine
APIs

Managed Elements
Cmdlets WMI COM .NET

Improved Execution Context Object Adapters


Object Mgr

WMI++
ADO ADSI

XML

Debugger

New Cmdlets Native Commands

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!

Virtual User Group


Marco Shaw runs a monthly users group meeting online using Microsoft Live Meeting
Interviews Q&A with experts

Check news for upcoming events and Marcos get-powershellblog (marcoshaw.blogspot.com)

PowerShell Newsgroup
Use NNTP server msnews.microsoft.com or web portal Group name: microsoft.public.windows.powershell

#powershell IRC Chat Room


Freenode IRC network: irc.freenode.net Interactive PowerShell help from experts

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

Join the Community!


LinkedIn: PowerShell Power Users Twitter: #powershell hashtag Facebook: PowerScripting Podcast, Windows Powershell Users, The Scripting Guys

And You!
We need your participation If you blog about PowerShell, let us know! Get on the forums, newsgroups and chat

Universal Automation Features


User Experience
Shell

Engine
APIs

Managed Elements
Remoting
Cmdlets WMI COM .NET XML ADO ADSI Native Commands

Background Jobs Eventing

Language

Execution Context

Restricted PSSessions

Debugger

Mobile Object Object Mgr Model

New Cmdlets (So Far)


Remoting:
Invoke-Command New-PSSession Get-PSSession Push-PSSession Pop-PSSession Remove-PSSession

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

Event Viewer and ETW Logs:


Get-Event

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

Hyper-V Automation with Compellent and PowerShell 2.0


Shane Anderson Compellent

Automation Overview
VM Data File

PowerShell 2.0 Script

Validate Prerequisites

C:\VirtualMachines

Start VMs and Wait for Ready

Gold Image

= ..\TestVM30

= ..\TestVM49

Windows Server 2008 R2 Hyper-V Host

Create HTML Report

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

Microsoft and Compellent Joint Customer Webcast


Saving Money while Improving Service availability at Indiana University. http://www.microsoft.com/virtualization

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/

OReilly book by PowerShell Dev Lee Holmes Windows PowerShell Cookbook


http://www.oreilly.com/catalog/9780596528492/index.html

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

www.microsoft.com/learning Microsoft Certification and Training Resources

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

WSV08-HOL Introduction to Windows PowerShell Fundamentals


WSV19-HOL Windows Server 2008 R2: Server Management and PowerShell V2 WSV02-HOL Administering Internet Information Services (IIS) 7.0 by Using Windows PowerShell

Complete an evaluation on CommNet and enter to win!

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.

Das könnte Ihnen auch gefallen