PowerShell Technical Overview
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

PowerShell Technical Overview

on

  • 4,035 views

A technical overview of PowerShell. See http://blogs.msdn.com/allandcp/archive/2009/03/11/powershell-to-the-people-the-aftermath.aspx for more background and resources.

A technical overview of PowerShell. See http://blogs.msdn.com/allandcp/archive/2009/03/11/powershell-to-the-people-the-aftermath.aspx for more background and resources.

Statistics

Views

Total Views
4,035
Views on SlideShare
4,034
Embed Views
1

Actions

Likes
1
Downloads
107
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

PowerShell Technical Overview Presentation Transcript

  • 1. Windows PowerShell: A Technical Overview “ Something old, something new, something borrowed and something blue” Allan da Costa Pinto Windows PowerShell Fanboy Microsoft [email_address] http://blogs.msdn.com/allandcp
  • 2. For the .NET Developers in the crowd: Increase your .NET Skills with the free Training Kits http://tinyurl.com/6q5jqz
  • 3.
    • http://msevents.microsoft.com
    • Search for Virtual Labs
    • Search on PowerShell
  • 4.  Ricky Buch Program Manager Microsoft Corporation
    •  Kevin Michael Woley
    • Program Manager
    • Microsoft Corporation
    http://channel9.msdn.com/pdc2008/PC50/
  • 5.  
  • 6.  
  • 7.  
  • 8. http://blogs.msdn.com/powershell/archive/2009/01/14/windows-7-troubleshooting.aspx
  • 9. More…
  • 10. http://channel9.msdn.com/pdc2008/ES14/ ASP.NET on Server Core Integrated PowerShell Provider Integrated FTP and WebDAV New IIS Manager Modules Configuration Logging & Tracing Best Practices Analyzer
  • 11. http://channel9.msdn.com/pdc2008/ES06/
  • 12. IIS/WAS Quadrant IIS Manager WF and WCF Frameworks Persistence SQL Persistence Provider Management APIs ( PowerShell command-lets) WF and WCF Management Modules Runtime Databases Persistence schema Monitoring schema Monitoring WF SQL Tracking Provider WCF SQL Tracking Behaviors Messaging Forwarding Service Hosting Durable Timer Service Visual Studio WF and WCF Project Templates Windows Application Server Role Model Deployment to Dublin Discovery Service Dublin adds Dublin enhances Windows/IIS/.NET 4.0 Scale-out & Reliability Discovery & Control Application Monitoring Versioning, Partitioning, Routing System Center App Server SCOM Pack “ It just works!” http://channel9.msdn.com/pdc2008/BB18
  • 13.  
  • 14. http://www.codeplex.com/PSHyperv
  • 15. http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg24017698
  • 16. http://halr9000.com/article/716 Costly
  • 17. I don’t have an iPhone but if I did… http://tinyurl.com/b62o8f
  • 18. No .NET? Know .NET?
    • Object Oriented scripting language and shell built on .NET Framework
    • Backwards Compatible and works with COM, WMI, .NET, XML
    • Easy to learn, adopt, automate and extend with a thriving community
    • Hosted in other applications (MMC 3.0, custom)
    • Available for Windows XP, Windows 2003 and Windows Vista
    • In the box with Windows Server 2008, Windows 7 and Windows Server 2008 R2
    • 1.0 born in 2006, 2.0 currently in CTP V3
  • 19. Exchange 2007 –eq "Much Simpler" Exchange Server 2003 (VBScript) E2K7 (PowerShell one-liner) Mailbox Statistics Set listExchange_Mailboxs = GetObject("winmgmts:{impersonationLevel=impersonate}!OMPUTERNAMEROOTMicrosoftExchangeV2").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 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: ewlogPath", 0) move-storagegrouppath -identity “First Storage Group“ – log "C: ewlogPath” 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 domainFOO – database “First Storage GroupPrivate MDB”
  • 20. Exchange 2007 Management Architecture CLI GUI Setup Process Boundary Exchange cmdlets Configuration Data Objects/Access PowerShell Data Provider PowerShell Engine Windows Forms Early-bound objs Windows Forms ADO.NET MAPI Store Registry Meta base AD
  • 21. Get-Command Get-Help Get-Member Get-PSDrive Get the Free eBook and information about the 4 most important CmdLets http://tinyurl.com/powershell4
  • 22. Anatomy
  • 23. http://www.flickr.com/photos/ajari/2288043144/
  • 24. http://www.flickr.com/photos/mnkyhead/3292809/
  • 25. Verb – Noun
    • Clear – Host
    • Set – ExecutionPolicy
    • Get – Help
    • Write – Debug
    • Restart – Computer
      • Don’t do this during session, but -whatif you did?
    • Drink – Beer
      • Do this before session 
  • 26. http://www.flickr.com/photos/dnorman/2249376120/
  • 27. http://www.flickr.com/photos/9229859@N02/1951252254/
  • 28. http://www.flickr.com/photos/adactio/377537734/
  • 29. The PowerShell pipeline Get-Process | Where { $_.handles –gt 500 } | Sort handles | Format-Table Get-Process Cmdlet Common Windows PowerShell Parser Windows PowerShell Pipeline Processor Where-Object Cmdlet Sort -Object Cmdlet Format-Table Cmdlet Alias Alias
  • 30. A Review
    • Cmdlets
      • Tiny commands
      • Composability
    • Providers
      • Abstraction of drives
      • Discoverability
    • Snap-ins
      • Unit of deployment
      • Wraps cmdlets, providers, etc
    PS C:> Get-Process PS C:> cd HKLM: PS HKLM: > PS C:> add-pssnapin MySnapIn
  • 31. Modifying the system
    • Support -confirm and -whatif operations
      • CmdletAttribute[..., SupportsShouldProcess = true ]
      • Call ShouldProcess for initial confirmation
        • Are you sure?
      • Call ShouldContinue for additional confirmation
        • Are you really sure?
        • Enable/disable “yes to all” and “no to all” options
      • Provide a “force” parameter to bypass these calls
    • Specify the impact of the cmdlet
      • Allows user to set the confirm sensitivity
      • CmdletAttribute[..., ConfirmImpact = ConfirmImpact.High ]
  • 32. Extending Windows PowerShell
    • Aliases
    • Functions
    • Cmdlets
      • Write them in .NET (v1)
      • Write them in PowerShell (v2)
    • Providers
      • IIS, SQL, Exchange, Yours
    • Custom Hosts
      • http://blogs.msdn.com/daiken/archive/2007/06/22/hosting-windows-powershell-sample-code.aspx
  • 33. PowerShell Architecture
  • 34. PowerShell Architecture Add Creativity Here!
  • 35. PowerShell V2 Themes
  • 36. Extended Type System (ETS)
    • Type Adapters provide consistent object access across different technologies
      • .NET, COM, WMI, ADSI, XML, ADO
    • Allows scripts to be general regardless of “native” object interaction
      • Scripts can be based on property names not programming knowledge classes and types
    • Object utilities work against all objects
    http://www.flickr.com/photos/foundphotoslj/449085680/
  • 37.
    • Shell Defaults
    • No scripts run (ExecutionPolicy=Restricted)
    • .ps1 is associated with Notepad
    • Must provide a path to a script file in order to run it
    • You Can Configure
    • ExecutionPolicy
      • Restricted
      • AllSigned
      • RemoteSigned
      • Unrestricted (No!!!)
    • Centrally configurable via Group Policy
    • In V2 Constrain Runspaces
  • 38. Resources!
    • Team blog
      • http://blogs.msdn.com/PowerShell/
    • PowerShellCommunity.Org
      • http://www.PowershellCommunity.Org
    • Channel 9
      • http://channel9.msdn.com/tags/PowerShell
      • 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
    • Books I own
      • 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
    • Newsgroup: Microsoft.Public.Windows.PowerShell
  • 39. Out-Thankyou PS C:> Thank you for your time and attention. Good luck in your PowerShell Adventures! Get-Allandcp PS C:> Allan da Costa Pinto Microsoft [email_address] http://blogs.msdn.com/allandcp