PowerShell for the Anxious ITPro:
Jason Himmelstein
Senior Technical Director, SharePoint
@sharepointlhorn
http://blog.sha...
2009 Atrion Networking Corporation
• Senior Technical Director, SharePoint at Atrion
• Microsoft vTSP
– virtual Technology...
2009 Atrion Networking Corporation
Agenda
• Introduction
• What is it?
• History
• The Why
• Basics
• Core principles
• Do...
2009 Atrion Networking Corporation
What is it?
• It isn't:
– Fire and forget
– A packaged executable
– Developer-centric
–...
2009 Atrion Networking Corporation
What is it?
• Windows PowerShell is Microsoft's task automation framework, consisting o...
2009 Atrion Networking Corporation
History
• Started internally at Microsoft in 2002
• Demo'ed at PDC in 2003 - early stag...
2009 Atrion Networking Corporation
The Why
• Why did Microsoft create PowerShell & move more to a
PowerShell world than a ...
2009 Atrion Networking Corporation
The Basics
• The "hardware"
• PowerShell Console vs PowerShell ISE
• The terminology
• ...
2009 Atrion Networking Corporation
Core Principles
• members
• objects
• pipelines
• verb-noun
• dot sourcing
• parsing
Simple Hard Demos
Shell
PowerShell ISE
Profiles
Modules
Transcript
Add-Server2Farm
2009 Atrion Networking Corporation
The Do’s
• Use variables
• Only one thing at a time
• Comment your scripts
• Follow a v...
2009 Atrion Networking Corporation
Do Not’s
• Vary your variables
• Hard code your scripts
• Take code from the internet o...
2009 Atrion Networking Corporation
Practical Application
• Get help
• Format your output
• Output PowerShell to a file
• C...
Easy to Medium Demos
Command
Using a variable
With query for path
With trycatch & output logging
USB Copy Script
New-Serve...
2009 Atrion Networking Corporation
Functional Explanation
• Get-verb
– Gets approved Windows PowerShell verbs
• Get-member...
2009 Atrion Networking Corporation
Sebism re: Try Catch
• Try catch
– From Seb Matthews:
• try – run the script elements w...
Wicked Hard Demos
Output-oneNote
Get-QuotaInfo
Create-DomainAccounts
New-PSProfile
Update-hostsfile
new-ms_ssa
New-farm
Handy information
• Jason’s info
– http://blog.sharepointlonghorn.com
– jase@sharepointlonghorn.com
– @sharepointlhorn
• S...
2009 Atrion Networking Corporation
…and if you don’t win,
GO BUY IT!
http://bit.ly/SharePointBI
2009 Atrion Networking Corporation
• Senior Technical Director, SharePoint at Atrion
• Microsoft vTSP
– virtual Technology...
PowerShell for the Anxious ITPro
Upcoming SlideShare
Loading in...5
×

PowerShell for the Anxious ITPro

1,089

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,089
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
44
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "PowerShell for the Anxious ITPro"

  1. 1. PowerShell for the Anxious ITPro: Jason Himmelstein Senior Technical Director, SharePoint @sharepointlhorn http://blog.sharepointlonghorn.com
  2. 2. 2009 Atrion Networking Corporation • Senior Technical Director, SharePoint at Atrion • Microsoft vTSP – virtual Technology Solutions Professional • SharePoint Foundation Logger – http://spflogger.codeplex.com • Blog: www.sharepointlonghorn.com • Twitter: @sharepointlhorn • LinkedIn: www.linkedin.com/in/jasonhimmelstein • SlideShare: http://www.slideshare.net/jasonhimmelstein • Email: jase@sharepointlonghorn.com • Author of Developing Business Intelligence Apps for SharePoint – http://bit.ly/SharePointBI
  3. 3. 2009 Atrion Networking Corporation Agenda • Introduction • What is it? • History • The Why • Basics • Core principles • Do's & Do not's • Practical application • Functional Explanation • Sebisms • Wrap up
  4. 4. 2009 Atrion Networking Corporation What is it? • It isn't: – Fire and forget – A packaged executable – Developer-centric – Too hard for an ITPro • It is: – Command line environment – Microsoft technology holistic – A swiss army knife with a chain saw – The future of ITPro's world
  5. 5. 2009 Atrion Networking Corporation What is it? • Windows PowerShell is Microsoft's task automation framework, consisting of a command- line shell and associated scripting language built on .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems. – Definition from Wikipedia • What is it really – PowerShell is an object-based, not text-based, command-line interface for Microsoft Technologies • What does that mean: – Results in PowerShell can be acted upon, not just read from
  6. 6. 2009 Atrion Networking Corporation History • Started internally at Microsoft in 2002 • Demo'ed at PDC in 2003 - early stage • Private beta • Public Beta in June 2005 • April 2006 changed the name to PowerShell • PowerShell v1 for RTW on Nov 14 2006 • PowerShell v2 was released in Aug 2009 as a part of Win7 & Server 2008 R2 • PowerShell v3 was released as a part of Win8 & Server 2012 • PowerShell v4 is coming as a part of Server 2012 R2
  7. 7. 2009 Atrion Networking Corporation The Why • Why did Microsoft create PowerShell & move more to a PowerShell world than a GUI world? • What is it used for: – Deployment – Configuration – Management – Administration – Development
  8. 8. 2009 Atrion Networking Corporation The Basics • The "hardware" • PowerShell Console vs PowerShell ISE • The terminology • Shell • Command-lets - "cmdlets" • Variables • Pipeline • Scripts • Functions • Modules
  9. 9. 2009 Atrion Networking Corporation Core Principles • members • objects • pipelines • verb-noun • dot sourcing • parsing
  10. 10. Simple Hard Demos Shell PowerShell ISE Profiles Modules Transcript Add-Server2Farm
  11. 11. 2009 Atrion Networking Corporation The Do’s • Use variables • Only one thing at a time • Comment your scripts • Follow a verb-noun scripting format • Create scripts using an ISEIDE, execute in shell • Dispose of your objects code • Test before using in Production • Write re-usable scripts • KISS method – Keep it simple, scripter! …you thought I was going to call you stupid didn’t you?
  12. 12. 2009 Atrion Networking Corporation Do Not’s • Vary your variables • Hard code your scripts • Take code from the internet or vendor & just RUN in your environment • Assume that code is not harmful… it is. • Run your code in an IDEISE and expect everything to work
  13. 13. 2009 Atrion Networking Corporation Practical Application • Get help • Format your output • Output PowerShell to a file • Create file • Use variables • Get and use DateTime stamp • Append text to a file • Use an ifelse loop
  14. 14. Easy to Medium Demos Command Using a variable With query for path With trycatch & output logging USB Copy Script New-ServerPrep
  15. 15. 2009 Atrion Networking Corporation Functional Explanation • Get-verb – Gets approved Windows PowerShell verbs • Get-member – Listing the Properties and Methods of a Command or Object • Get-history – If you didn’t start transcript, you can still review your history before closing your Shell or ISE window
  16. 16. 2009 Atrion Networking Corporation Sebism re: Try Catch • Try catch – From Seb Matthews: • try – run the script elements within this block – nice, safe bubble for running cmdlets that may fail • catch – jump to this block (or blocks) if an error occurs in what you “try” – bubble in which you can handle the error appropriately – you can have multiple catch blocks which can be ordered by the nature of the error – see my PowerTip about this • finally – jump to this block after try or catch regardless of whether an error was generated – this block is really here to enable cleanup (such as object disposal) – remember it runs regardless of the error state!
  17. 17. Wicked Hard Demos Output-oneNote Get-QuotaInfo Create-DomainAccounts New-PSProfile Update-hostsfile new-ms_ssa New-farm
  18. 18. Handy information • Jason’s info – http://blog.sharepointlonghorn.com – jase@sharepointlonghorn.com – @sharepointlhorn • Seb Matthews – http://sebmatthews.com • This Deck is available now at http://bit.ly/itpro-powershell • SharePoSH Virtual Users Group – http://www.shareposh.com/ • PowerShell.org – http://www.powershell.org • The Scripting Guy – http://blogs.technet.com/b/heyscriptingguy/
  19. 19. 2009 Atrion Networking Corporation …and if you don’t win, GO BUY IT! http://bit.ly/SharePointBI
  20. 20. 2009 Atrion Networking Corporation • Senior Technical Director, SharePoint at Atrion • Microsoft vTSP – virtual Technology Solutions Professional • SharePoint Foundation Logger – http://spflogger.codeplex.com • Blog: www.sharepointlonghorn.com • Twitter: @sharepointlhorn • LinkedIn: www.linkedin.com/in/jasonhimmelstein • SlideShare: http://www.slideshare.net/jasonhimmelstein • Email: jase@sharepointlonghorn.com • Author of Developing Business Intelligence Apps for SharePoint – http://bit.ly/SharePointBI
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×