SlideShare a Scribd company logo
1 of 21
PowerShell for the Anxious ITPro:
Jason Himmelstein
Senior Technical Director, SharePoint
@sharepointlhorn
http://blog.sharepointlonghorn.com
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
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
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
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
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
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
2009 Atrion Networking Corporation
The Basics
• The "hardware"
• PowerShell Console vs PowerShell ISE
• The terminology
• Shell
• Command-lets - "cmdlets"
• Variables
• Pipeline
• Scripts
• Functions
• Modules
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 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?
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
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
Easy to Medium Demos
Command
Using a variable
With query for path
With trycatch & output logging
USB Copy Script
New-ServerPrep
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
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!
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
• 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/
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 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

More Related Content

What's hot

Practical management of development & QA environments for SharePoint 2013
Practical management of development & QA environments for SharePoint 2013Practical management of development & QA environments for SharePoint 2013
Practical management of development & QA environments for SharePoint 2013
SharePointRadi
 

What's hot (20)

SharePoint 2010 Upgrade Drill Down
SharePoint 2010 Upgrade Drill DownSharePoint 2010 Upgrade Drill Down
SharePoint 2010 Upgrade Drill Down
 
Deploying and Managing PowerPivot for SharePoint
Deploying and Managing PowerPivot for SharePointDeploying and Managing PowerPivot for SharePoint
Deploying and Managing PowerPivot for SharePoint
 
Himmelstein SP Connections Session HAD308 Heavy Metal Power Pivot
Himmelstein SP Connections Session HAD308 Heavy Metal Power PivotHimmelstein SP Connections Session HAD308 Heavy Metal Power Pivot
Himmelstein SP Connections Session HAD308 Heavy Metal Power Pivot
 
ECS19 - Thomas Vochten - ESSENTIAL DATABASE ADMINISTRATION SKILLS FOR SHAREPO...
ECS19 - Thomas Vochten - ESSENTIAL DATABASE ADMINISTRATION SKILLS FOR SHAREPO...ECS19 - Thomas Vochten - ESSENTIAL DATABASE ADMINISTRATION SKILLS FOR SHAREPO...
ECS19 - Thomas Vochten - ESSENTIAL DATABASE ADMINISTRATION SKILLS FOR SHAREPO...
 
Teched Middle East New World of SharePoint 2010 Administration with Joel Oles...
Teched Middle East New World of SharePoint 2010 Administration with Joel Oles...Teched Middle East New World of SharePoint 2010 Administration with Joel Oles...
Teched Middle East New World of SharePoint 2010 Administration with Joel Oles...
 
Peter Ward: The True Power of SharePoint Designer Workflows
Peter Ward: The True Power of SharePoint Designer WorkflowsPeter Ward: The True Power of SharePoint Designer Workflows
Peter Ward: The True Power of SharePoint Designer Workflows
 
Office Web Apps Server 2013
Office Web Apps Server 2013Office Web Apps Server 2013
Office Web Apps Server 2013
 
Analytically shiny and new: A guided tour of Microsoft’s Business Intelligenc...
Analytically shiny and new: A guided tour of Microsoft’s Business Intelligenc...Analytically shiny and new: A guided tour of Microsoft’s Business Intelligenc...
Analytically shiny and new: A guided tour of Microsoft’s Business Intelligenc...
 
Don't upgrade to SharePoint 2013
Don't upgrade to SharePoint 2013Don't upgrade to SharePoint 2013
Don't upgrade to SharePoint 2013
 
Get your SharePoint spinning with SQL Server
Get your SharePoint spinning with SQL ServerGet your SharePoint spinning with SQL Server
Get your SharePoint spinning with SQL Server
 
ECS19 - Tomislav Lulic - What is changed in product/service licensing with Cl...
ECS19 - Tomislav Lulic - What is changed in product/service licensing with Cl...ECS19 - Tomislav Lulic - What is changed in product/service licensing with Cl...
ECS19 - Tomislav Lulic - What is changed in product/service licensing with Cl...
 
Practical management of development & QA environments for SharePoint 2013
Practical management of development & QA environments for SharePoint 2013Practical management of development & QA environments for SharePoint 2013
Practical management of development & QA environments for SharePoint 2013
 
MinRole and SharePoint 2016
MinRole and SharePoint 2016MinRole and SharePoint 2016
MinRole and SharePoint 2016
 
Integrating Office Web Apps with SharePoint 2013
Integrating Office Web Apps with SharePoint 2013Integrating Office Web Apps with SharePoint 2013
Integrating Office Web Apps with SharePoint 2013
 
SharePoint Office Web Apps 2013 presentation
SharePoint Office Web Apps 2013 presentationSharePoint Office Web Apps 2013 presentation
SharePoint Office Web Apps 2013 presentation
 
SharePoint 2016 Upgrade Planning
SharePoint 2016 Upgrade PlanningSharePoint 2016 Upgrade Planning
SharePoint 2016 Upgrade Planning
 
ECS19 - Robi Voncina - Upgrade to SharePoint 2019
ECS19 - Robi Voncina - Upgrade to SharePoint 2019ECS19 - Robi Voncina - Upgrade to SharePoint 2019
ECS19 - Robi Voncina - Upgrade to SharePoint 2019
 
Migrate SharePoint 2016 To SharePoint 2019 Environment Using Content Database...
Migrate SharePoint 2016 To SharePoint 2019 Environment Using Content Database...Migrate SharePoint 2016 To SharePoint 2019 Environment Using Content Database...
Migrate SharePoint 2016 To SharePoint 2019 Environment Using Content Database...
 
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
 
Ecs19 - Hans Brender - Is OneDrive Really Enterprise Ready
Ecs19 - Hans Brender -  Is OneDrive Really Enterprise ReadyEcs19 - Hans Brender -  Is OneDrive Really Enterprise Ready
Ecs19 - Hans Brender - Is OneDrive Really Enterprise Ready
 

Viewers also liked

Viewers also liked (6)

Battle-scarred but still standing: A SharePoint Admin’s Tell-All
Battle-scarred but still standing: A SharePoint Admin’s Tell-All Battle-scarred but still standing: A SharePoint Admin’s Tell-All
Battle-scarred but still standing: A SharePoint Admin’s Tell-All
 
Microsoft Office Web Apps
Microsoft Office Web AppsMicrosoft Office Web Apps
Microsoft Office Web Apps
 
New Office Web Apps story
New Office Web Apps storyNew Office Web Apps story
New Office Web Apps story
 
SharePoint Performance: Best Practices from the Field
SharePoint Performance: Best Practices from the FieldSharePoint Performance: Best Practices from the Field
SharePoint Performance: Best Practices from the Field
 
Sky drive and Web Apps
Sky drive and Web AppsSky drive and Web Apps
Sky drive and Web Apps
 
ITPro's taking the SharePoint 2013 Red Pill
ITPro's taking the SharePoint 2013 Red PillITPro's taking the SharePoint 2013 Red Pill
ITPro's taking the SharePoint 2013 Red Pill
 

Similar to PowerShell for the Anxious ITPro

Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePoint
Jeremy Thake
 

Similar to PowerShell for the Anxious ITPro (20)

Managing SharePoint Anywhere with Windows PowerShell
Managing SharePoint Anywhere with Windows PowerShellManaging SharePoint Anywhere with Windows PowerShell
Managing SharePoint Anywhere with Windows PowerShell
 
Spsatx slides (widescreen)
Spsatx slides (widescreen)Spsatx slides (widescreen)
Spsatx slides (widescreen)
 
Intro to SharePoint + PowerShell
Intro to SharePoint + PowerShellIntro to SharePoint + PowerShell
Intro to SharePoint + PowerShell
 
Introduction to PowerShell for SharePoint Admins and Developers
Introduction to PowerShell for SharePoint Admins and DevelopersIntroduction to PowerShell for SharePoint Admins and Developers
Introduction to PowerShell for SharePoint Admins and Developers
 
Stackato
StackatoStackato
Stackato
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
SharePoint 2010 Development for ASP.NET Developers - Tyson Devcon 2010
SharePoint 2010 Development for ASP.NET Developers - Tyson Devcon 2010SharePoint 2010 Development for ASP.NET Developers - Tyson Devcon 2010
SharePoint 2010 Development for ASP.NET Developers - Tyson Devcon 2010
 
[Pinto] Is my SharePoint Development team properly enlighted?
[Pinto] Is my SharePoint Development team properly enlighted?[Pinto] Is my SharePoint Development team properly enlighted?
[Pinto] Is my SharePoint Development team properly enlighted?
 
Icon UK 2018 - Spring forward: an introduction to Spring boot and Thymeleaf f...
Icon UK 2018 - Spring forward: an introduction to Spring boot and Thymeleaf f...Icon UK 2018 - Spring forward: an introduction to Spring boot and Thymeleaf f...
Icon UK 2018 - Spring forward: an introduction to Spring boot and Thymeleaf f...
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePoint
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)
 
SPSDenver - Wrapping Your Head Around the SharePoint Beast
SPSDenver - Wrapping Your Head Around the SharePoint BeastSPSDenver - Wrapping Your Head Around the SharePoint Beast
SPSDenver - Wrapping Your Head Around the SharePoint Beast
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
SharePoint Saturday Cincinnati 2014 - CSOM
SharePoint Saturday Cincinnati 2014 - CSOMSharePoint Saturday Cincinnati 2014 - CSOM
SharePoint Saturday Cincinnati 2014 - CSOM
 
Making your user happy – how to create a perfect profile
Making your user happy – how to create a perfect profileMaking your user happy – how to create a perfect profile
Making your user happy – how to create a perfect profile
 
PowerShell Introduction to Administering SharePoint On-Premises & O365
PowerShell Introduction to Administering SharePoint On-Premises & O365PowerShell Introduction to Administering SharePoint On-Premises & O365
PowerShell Introduction to Administering SharePoint On-Premises & O365
 
Highlights from microsoft ignite 2015
Highlights from microsoft ignite 2015Highlights from microsoft ignite 2015
Highlights from microsoft ignite 2015
 

More from Jason Himmelstein

More from Jason Himmelstein (19)

SharePoint Migration in the real world: a cautionary tale of success
SharePoint Migration in the real world: a cautionary tale of successSharePoint Migration in the real world: a cautionary tale of success
SharePoint Migration in the real world: a cautionary tale of success
 
Dive into Microsoft SharePoint Server 2016 Upgrade and Migration
Dive into Microsoft SharePoint Server 2016 Upgrade and MigrationDive into Microsoft SharePoint Server 2016 Upgrade and Migration
Dive into Microsoft SharePoint Server 2016 Upgrade and Migration
 
The Power of BI: A guided tour of Microsoft's Business Intelligence tooling
The Power of BI: A guided tour of Microsoft's Business Intelligence toolingThe Power of BI: A guided tour of Microsoft's Business Intelligence tooling
The Power of BI: A guided tour of Microsoft's Business Intelligence tooling
 
Dive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyond
Dive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyondDive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyond
Dive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyond
 
What’s new in SharePoint 2016 Beta 2?
What’s new in SharePoint 2016 Beta 2?What’s new in SharePoint 2016 Beta 2?
What’s new in SharePoint 2016 Beta 2?
 
Making sense of Microsoft Identities in a Hybrid world
Making sense of Microsoft Identities in a Hybrid worldMaking sense of Microsoft Identities in a Hybrid world
Making sense of Microsoft Identities in a Hybrid world
 
Implementing Azure Active Directory Connect and more
Implementing Azure Active Directory Connect and moreImplementing Azure Active Directory Connect and more
Implementing Azure Active Directory Connect and more
 
PowerShell for the Anxious ITPro
PowerShell for the Anxious ITProPowerShell for the Anxious ITPro
PowerShell for the Anxious ITPro
 
Making sense of Microsoft Identities in a Hybrid world
Making sense of Microsoft Identities in a Hybrid worldMaking sense of Microsoft Identities in a Hybrid world
Making sense of Microsoft Identities in a Hybrid world
 
PowerShell for the Hybrid Admin
PowerShell for the Hybrid AdminPowerShell for the Hybrid Admin
PowerShell for the Hybrid Admin
 
Navigating the turbulence on takeoff: Setting up SharePoint on Azure IaaS the...
Navigating the turbulence on takeoff: Setting up SharePoint on Azure IaaS the...Navigating the turbulence on takeoff: Setting up SharePoint on Azure IaaS the...
Navigating the turbulence on takeoff: Setting up SharePoint on Azure IaaS the...
 
Battle scarred but still standing publish: A SharePoint Admin's tell-all
Battle scarred but still standing publish: A SharePoint Admin's tell-allBattle scarred but still standing publish: A SharePoint Admin's tell-all
Battle scarred but still standing publish: A SharePoint Admin's tell-all
 
Navigating the turbulence on take-off: Setting up SharePoint on Azure IaaS th...
Navigating the turbulence on take-off: Setting up SharePoint on Azure IaaS th...Navigating the turbulence on take-off: Setting up SharePoint on Azure IaaS th...
Navigating the turbulence on take-off: Setting up SharePoint on Azure IaaS th...
 
Achieving Better Business Productivity through Apps for Office
Achieving Better Business Productivity through Apps for Office Achieving Better Business Productivity through Apps for Office
Achieving Better Business Productivity through Apps for Office
 
SharePoint 2013 Admin in the Hybrid World
SharePoint 2013 Admin in the Hybrid WorldSharePoint 2013 Admin in the Hybrid World
SharePoint 2013 Admin in the Hybrid World
 
Business Intelligence in SharePoint 2013
Business Intelligence in SharePoint 2013Business Intelligence in SharePoint 2013
Business Intelligence in SharePoint 2013
 
Heavy Metal PowerPivot
Heavy Metal PowerPivotHeavy Metal PowerPivot
Heavy Metal PowerPivot
 
Business intelligence in SharePoint 2013
Business intelligence in SharePoint 2013Business intelligence in SharePoint 2013
Business intelligence in SharePoint 2013
 
Battle Scarred But Still Standing: A SharePoint Administrator’s Tell All
Battle Scarred But Still Standing: A SharePoint Administrator’s Tell AllBattle Scarred But Still Standing: A SharePoint Administrator’s Tell All
Battle Scarred But Still Standing: A SharePoint Administrator’s Tell All
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

PowerShell for the Anxious ITPro

  • 1. PowerShell for the Anxious ITPro: Jason Himmelstein Senior Technical Director, SharePoint @sharepointlhorn http://blog.sharepointlonghorn.com
  • 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. 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. 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. 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. 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. 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. 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. 2009 Atrion Networking Corporation Core Principles • members • objects • pipelines • verb-noun • dot sourcing • parsing
  • 10. Simple Hard Demos Shell PowerShell ISE Profiles Modules Transcript Add-Server2Farm
  • 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. 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. 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. Easy to Medium Demos Command Using a variable With query for path With trycatch & output logging USB Copy Script New-ServerPrep
  • 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. 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!
  • 18.
  • 19. 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/
  • 20. 2009 Atrion Networking Corporation …and if you don’t win, GO BUY IT! http://bit.ly/SharePointBI
  • 21. 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