際際滷

際際滷Share a Scribd company logo
08 | Getting prepared for automation
Jeffrey Snover | Distinguished Engineer & Lead Architect
Jason Helmick | Senior Technologist, Concentrated
Technology
Course Topics
Getting Started with PowerShell
01 | Dont fear the shell

06 | The pipeline : Deeper

02 | The Help system

07 | The Power in the Shell - Remoting

03 | The pipeline : Getting connected

08 | Getting prepared for automation

04 | Extending the shell

09 | Automation in scale - Remoting

05 | Objects for the Admin

10 | Introducing scripting and toolmaking
Module Overview
 PowerShell security goals

 Execution Policy
 Variables : a place to store stuff
 Fun with Quotes
 Getting and displaying input
 Other output for scripts and automation
PowerShell security goals

 Secured by default
 Prevents mistakes by
unintentional admins and
users
 No Script Execution
 .Ps1 associated with notepad
 Must type path to execute a
script
Execution Policy
 By default, PowerShell does
not run scripts.
 Get/Set-ExecutionPolicy
 Restricted
 Unrestricted
 AllSigned
 RemoteSigned
 Bypass
 Undefined
 Can be set with Group Policy
Variables: A place to store stuff
 Use $ to create and use
variables
 Can contain letters, numbers,
spaces and underscores
 Dont persist after Shell exits

 New-Variable
 Set-Variable
 Get-Variable

 Clear-Variable
 Remove-Variable
 Can force a type  [int]$var

Note: The $ is not part of the variable
name, its a cue to access the contents
of the variable
Fun with Quotes
 Double Quotes resolve all
variables
 Can use Sub-Expressions
 Single Quotes prevent
substitution
 Get-Help
About_Quoting_Rules

 Back-tick/Grave-Accent
prevents individual substitution
Getting and displaying input
Other output for scripts and automation
 Write-Warning
 Write-Verbose

 Write-Debug
 Write-Error







$Preference variables to know
Help about_Preference_Variables
$DebugPreference=SilentlyContinue
$ErrorActionPreference=Continue
#VerbosePreference=SilentlyContinue
Questions or comments?
息2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.

More Related Content

Similar to 08 getting prepared for automation (20)

02 the help system
02 the help system02 the help system
02 the help system
Shubham Atkare
10 introducing scripting and toolmaking
10 introducing scripting and toolmaking10 introducing scripting and toolmaking
10 introducing scripting and toolmaking
Shubham Atkare
Developer day v2
Developer day v2Developer day v2
Developer day v2
AiougVizagChapter
Improving the Design of Existing Software
Improving the Design of Existing SoftwareImproving the Design of Existing Software
Improving the Design of Existing Software
Steven Smith
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java Platform
JavaDayUA
Doing Drupal security right
Doing Drupal security rightDoing Drupal security right
Doing Drupal security right
G叩bor Hojtsy
Oracle SQL Developer Data Modeler - for SQL Server
Oracle SQL Developer Data Modeler - for SQL ServerOracle SQL Developer Data Modeler - for SQL Server
Oracle SQL Developer Data Modeler - for SQL Server
Jeff Smith
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf
Module-1_Getting-Started_with_selenium_and_Java_basics.pdfModule-1_Getting-Started_with_selenium_and_Java_basics.pdf
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf
devika266518
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & TricksPennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Jeff Smith
01 dont fear the shell 1
01 dont fear the shell 101 dont fear the shell 1
01 dont fear the shell 1
Shubham Atkare
Debugging PL/SQL with Oracle SQL Developer
Debugging PL/SQL with Oracle SQL DeveloperDebugging PL/SQL with Oracle SQL Developer
Debugging PL/SQL with Oracle SQL Developer
Jeff Smith
Oracle Enterprise Manager Security: A Practitioners Guide
Oracle Enterprise Manager Security: A Practitioners GuideOracle Enterprise Manager Security: A Practitioners Guide
Oracle Enterprise Manager Security: A Practitioners Guide
Courtney Llamas
Pimping SQL Developer and Data Modeler
Pimping SQL Developer and Data ModelerPimping SQL Developer and Data Modeler
Pimping SQL Developer and Data Modeler
Kris Rice
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
AWR and ASH Deep Dive
AWR and ASH Deep DiveAWR and ASH Deep Dive
AWR and ASH Deep Dive
Kellyn Pot'Vin-Gorman
What is DevOps?
What is DevOps?What is DevOps?
What is DevOps?
jeckels
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
Dan Poltawski
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
Steven Smith
06 integrating extra features and looking forward
06   integrating extra features and looking forward06   integrating extra features and looking forward
06 integrating extra features and looking forward
舒亳仆舒 仂仂于舒
Drupal security
Drupal securityDrupal security
Drupal security
Jozef Toth
10 introducing scripting and toolmaking
10 introducing scripting and toolmaking10 introducing scripting and toolmaking
10 introducing scripting and toolmaking
Shubham Atkare
Improving the Design of Existing Software
Improving the Design of Existing SoftwareImproving the Design of Existing Software
Improving the Design of Existing Software
Steven Smith
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java Platform
JavaDayUA
Doing Drupal security right
Doing Drupal security rightDoing Drupal security right
Doing Drupal security right
G叩bor Hojtsy
Oracle SQL Developer Data Modeler - for SQL Server
Oracle SQL Developer Data Modeler - for SQL ServerOracle SQL Developer Data Modeler - for SQL Server
Oracle SQL Developer Data Modeler - for SQL Server
Jeff Smith
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf
Module-1_Getting-Started_with_selenium_and_Java_basics.pdfModule-1_Getting-Started_with_selenium_and_Java_basics.pdf
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf
devika266518
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & TricksPennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Jeff Smith
01 dont fear the shell 1
01 dont fear the shell 101 dont fear the shell 1
01 dont fear the shell 1
Shubham Atkare
Debugging PL/SQL with Oracle SQL Developer
Debugging PL/SQL with Oracle SQL DeveloperDebugging PL/SQL with Oracle SQL Developer
Debugging PL/SQL with Oracle SQL Developer
Jeff Smith
Oracle Enterprise Manager Security: A Practitioners Guide
Oracle Enterprise Manager Security: A Practitioners GuideOracle Enterprise Manager Security: A Practitioners Guide
Oracle Enterprise Manager Security: A Practitioners Guide
Courtney Llamas
Pimping SQL Developer and Data Modeler
Pimping SQL Developer and Data ModelerPimping SQL Developer and Data Modeler
Pimping SQL Developer and Data Modeler
Kris Rice
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
What is DevOps?
What is DevOps?What is DevOps?
What is DevOps?
jeckels
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
Dan Poltawski
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
Steven Smith
06 integrating extra features and looking forward
06   integrating extra features and looking forward06   integrating extra features and looking forward
06 integrating extra features and looking forward
舒亳仆舒 仂仂于舒
Drupal security
Drupal securityDrupal security
Drupal security
Jozef Toth

Recently uploaded (20)

1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Praksha3
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptxCyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
KelishaCyrus
Inventory Reporting in Odoo 17 - Odoo 17 Inventory App
Inventory Reporting in Odoo 17 -  Odoo 17 Inventory AppInventory Reporting in Odoo 17 -  Odoo 17 Inventory App
Inventory Reporting in Odoo 17 - Odoo 17 Inventory App
Celine George
How to create security group category in Odoo 17
How to create security group category in Odoo 17How to create security group category in Odoo 17
How to create security group category in Odoo 17
Celine George
Oral exam Kenneth Bech - What is the meaning of strategic fit?
Oral exam Kenneth Bech - What is the meaning of strategic fit?Oral exam Kenneth Bech - What is the meaning of strategic fit?
Oral exam Kenneth Bech - What is the meaning of strategic fit?
MIPLM
Functional Muscle Testing of Facial Muscles.pdf
Functional Muscle Testing of Facial Muscles.pdfFunctional Muscle Testing of Facial Muscles.pdf
Functional Muscle Testing of Facial Muscles.pdf
SamarHosni3
Mastering Soft Tissue Therapy & Sports Taping
Mastering Soft Tissue Therapy & Sports TapingMastering Soft Tissue Therapy & Sports Taping
Mastering Soft Tissue Therapy & Sports Taping
Kusal Goonewardena
Intellectual Honesty & Research Integrity.pptx
Intellectual Honesty & Research Integrity.pptxIntellectual Honesty & Research Integrity.pptx
Intellectual Honesty & Research Integrity.pptx
NidhiSharma495177
teacher activies un classroom and students
teacher activies un classroom and studentsteacher activies un classroom and students
teacher activies un classroom and students
prabowoedy1
Dot NET Core Interview Questions PDF By ScholarHat
Dot NET Core Interview Questions PDF By ScholarHatDot NET Core Interview Questions PDF By ScholarHat
Dot NET Core Interview Questions PDF By ScholarHat
Scholarhat
OOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHatOOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHat
Scholarhat
ASP.NET Web API Interview Questions By Scholarhat
ASP.NET Web API Interview Questions By ScholarhatASP.NET Web API Interview Questions By Scholarhat
ASP.NET Web API Interview Questions By Scholarhat
Scholarhat
2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf
2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf
2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf
1mksmunathens
2024 Summer Nutrition North Carolina Profile
2024 Summer Nutrition North Carolina Profile2024 Summer Nutrition North Carolina Profile
2024 Summer Nutrition North Carolina Profile
Mebane Rash
Interim Guidelines for PMES-DM-17-2025-PPT.pptx
Interim Guidelines for PMES-DM-17-2025-PPT.pptxInterim Guidelines for PMES-DM-17-2025-PPT.pptx
Interim Guidelines for PMES-DM-17-2025-PPT.pptx
sirjeromemanansala
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
preetheshparmar
Azure Data Engineer Interview Questions By ScholarHat
Azure Data Engineer Interview Questions By ScholarHatAzure Data Engineer Interview Questions By ScholarHat
Azure Data Engineer Interview Questions By ScholarHat
Scholarhat
RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)
RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)
RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)
SONU HEETSON
21epigastric hernia.pptx xxxxxxx"xxxxxxx
21epigastric hernia.pptx xxxxxxx"xxxxxxx21epigastric hernia.pptx xxxxxxx"xxxxxxx
21epigastric hernia.pptx xxxxxxx"xxxxxxx
Praksha3
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1111.pptx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Praksha3
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptxCyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
KelishaCyrus
Inventory Reporting in Odoo 17 - Odoo 17 Inventory App
Inventory Reporting in Odoo 17 -  Odoo 17 Inventory AppInventory Reporting in Odoo 17 -  Odoo 17 Inventory App
Inventory Reporting in Odoo 17 - Odoo 17 Inventory App
Celine George
How to create security group category in Odoo 17
How to create security group category in Odoo 17How to create security group category in Odoo 17
How to create security group category in Odoo 17
Celine George
Oral exam Kenneth Bech - What is the meaning of strategic fit?
Oral exam Kenneth Bech - What is the meaning of strategic fit?Oral exam Kenneth Bech - What is the meaning of strategic fit?
Oral exam Kenneth Bech - What is the meaning of strategic fit?
MIPLM
Functional Muscle Testing of Facial Muscles.pdf
Functional Muscle Testing of Facial Muscles.pdfFunctional Muscle Testing of Facial Muscles.pdf
Functional Muscle Testing of Facial Muscles.pdf
SamarHosni3
Mastering Soft Tissue Therapy & Sports Taping
Mastering Soft Tissue Therapy & Sports TapingMastering Soft Tissue Therapy & Sports Taping
Mastering Soft Tissue Therapy & Sports Taping
Kusal Goonewardena
Intellectual Honesty & Research Integrity.pptx
Intellectual Honesty & Research Integrity.pptxIntellectual Honesty & Research Integrity.pptx
Intellectual Honesty & Research Integrity.pptx
NidhiSharma495177
teacher activies un classroom and students
teacher activies un classroom and studentsteacher activies un classroom and students
teacher activies un classroom and students
prabowoedy1
Dot NET Core Interview Questions PDF By ScholarHat
Dot NET Core Interview Questions PDF By ScholarHatDot NET Core Interview Questions PDF By ScholarHat
Dot NET Core Interview Questions PDF By ScholarHat
Scholarhat
OOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHatOOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHat
Scholarhat
ASP.NET Web API Interview Questions By Scholarhat
ASP.NET Web API Interview Questions By ScholarhatASP.NET Web API Interview Questions By Scholarhat
ASP.NET Web API Interview Questions By Scholarhat
Scholarhat
2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf
2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf
2025 MSKMUN NEWS 1.pdf 2025 MSKMUN NEWS 1.pdf
1mksmunathens
2024 Summer Nutrition North Carolina Profile
2024 Summer Nutrition North Carolina Profile2024 Summer Nutrition North Carolina Profile
2024 Summer Nutrition North Carolina Profile
Mebane Rash
Interim Guidelines for PMES-DM-17-2025-PPT.pptx
Interim Guidelines for PMES-DM-17-2025-PPT.pptxInterim Guidelines for PMES-DM-17-2025-PPT.pptx
Interim Guidelines for PMES-DM-17-2025-PPT.pptx
sirjeromemanansala
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
preetheshparmar
Azure Data Engineer Interview Questions By ScholarHat
Azure Data Engineer Interview Questions By ScholarHatAzure Data Engineer Interview Questions By ScholarHat
Azure Data Engineer Interview Questions By ScholarHat
Scholarhat
RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)
RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)
RRB ALP CBT 2 RAC Question Paper MCQ (Railway Assistant Loco Pilot)
SONU HEETSON
21epigastric hernia.pptx xxxxxxx"xxxxxxx
21epigastric hernia.pptx xxxxxxx"xxxxxxx21epigastric hernia.pptx xxxxxxx"xxxxxxx
21epigastric hernia.pptx xxxxxxx"xxxxxxx
Praksha3
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain

08 getting prepared for automation

  • 1. 08 | Getting prepared for automation Jeffrey Snover | Distinguished Engineer & Lead Architect Jason Helmick | Senior Technologist, Concentrated Technology
  • 2. Course Topics Getting Started with PowerShell 01 | Dont fear the shell 06 | The pipeline : Deeper 02 | The Help system 07 | The Power in the Shell - Remoting 03 | The pipeline : Getting connected 08 | Getting prepared for automation 04 | Extending the shell 09 | Automation in scale - Remoting 05 | Objects for the Admin 10 | Introducing scripting and toolmaking
  • 3. Module Overview PowerShell security goals Execution Policy Variables : a place to store stuff Fun with Quotes Getting and displaying input Other output for scripts and automation
  • 4. PowerShell security goals Secured by default Prevents mistakes by unintentional admins and users No Script Execution .Ps1 associated with notepad Must type path to execute a script
  • 5. Execution Policy By default, PowerShell does not run scripts. Get/Set-ExecutionPolicy Restricted Unrestricted AllSigned RemoteSigned Bypass Undefined Can be set with Group Policy
  • 6. Variables: A place to store stuff Use $ to create and use variables Can contain letters, numbers, spaces and underscores Dont persist after Shell exits New-Variable Set-Variable Get-Variable Clear-Variable Remove-Variable Can force a type [int]$var Note: The $ is not part of the variable name, its a cue to access the contents of the variable
  • 7. Fun with Quotes Double Quotes resolve all variables Can use Sub-Expressions Single Quotes prevent substitution Get-Help About_Quoting_Rules Back-tick/Grave-Accent prevents individual substitution
  • 9. Other output for scripts and automation Write-Warning Write-Verbose Write-Debug Write-Error $Preference variables to know Help about_Preference_Variables $DebugPreference=SilentlyContinue $ErrorActionPreference=Continue #VerbosePreference=SilentlyContinue
  • 11. 息2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.