SlideShare a Scribd company logo
1 of 18
Introduction to PowerShell Ivan Suhinin Senior Software Engineer
What is PowerShell? Automation engine Shell environment Scripting language
PowerShell as a shell A full replacement for CMD At last something bash-like in Windows Just… feel the power!
PowerShell as a language Variables: $a, $name Arrays:  $arr = 1,2,3,4,5,6;   $sarr=1..6 Hashes: $h = @{“Key1" = 23; “Key2" = 894} Functions: function hi ($name) { echo "Hi, $name!" } Classes:($o = New-Object Object) |Add-Member NoteProperty Name “Bianco"
PowerShell as an automation tool Predefined set of commands with lots of extensions Easy batch operations Simple command interconnections (pipelining)
Command types Cmdlets – Get-Location Functions User scripts - *.ps1 Native applications (msbuild, csc)
Cmdlets Predefined set of commands Form: Verb-Noun: Get-Location Get-ChildItem Set-Location Long, descriptive names for scripts Aliases for daily usage
Aliases Creating short names for long cmdlets Get-Alias, Set-Alias Makes scripting more friendly By default has standard UNIX aliases ls, ps, pwd, date, kill, gal, pushd, popd
Wiring commands up Pipelining: Get-Location | Get-Member Functional style .NET objects instead of strings (bash) Output becomes input Select – selecting only needed information Where – filtering results Group – grouping results ForEach – processing each input value
PowerShell providers Adapters to different subsystems Get-PSProvider, Get-PSDrive Default: WSMan, Alias, Environment, FileSystem, Registry Extended: IIS, SQL, SharePoint, VMWare
Using external components Windows Management Instrumentation (WMI) gwmi win32_service gwmi win32_operatingsystem COM (New-Object -ComObjectWScript.Shell).Run("calc.exe")
Using .NET Importing assemblies:[Reflection.Assembly]::LoadWithPartialName("System.Messaging") Calling static methods:[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("localhost") Creating and using objects:$b = New-Object System.Text.StringBuilder$b.Append("Hello!")
man Ultimate help system Examples Detailed Full
Demo: deleting MSMQ queues
Demo: sorting SQL tables by size
Demo: real-life deployment script
Development environment Autocompletion Tab key Wildcards Works for methods PowerShell ISE PowerGUI
Q & A

More Related Content

What's hot

CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_finalCSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CanSecWest
 

What's hot (20)

Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Android CTS training
Android CTS trainingAndroid CTS training
Android CTS training
 
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_finalCSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)
 
Linux basics part 1
Linux basics part 1Linux basics part 1
Linux basics part 1
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101
 
Ansible
AnsibleAnsible
Ansible
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
 
Enable Domino Data Access Services (DAS)
Enable Domino Data Access Services (DAS)Enable Domino Data Access Services (DAS)
Enable Domino Data Access Services (DAS)
 
Powershell Demo Presentation
Powershell Demo PresentationPowershell Demo Presentation
Powershell Demo Presentation
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Powershell training material
Powershell training materialPowershell training material
Powershell training material
 

Viewers also liked

PowerShell Scripting and Modularization (TechMentor Fall 2011)
PowerShell Scripting and Modularization (TechMentor Fall 2011)PowerShell Scripting and Modularization (TechMentor Fall 2011)
PowerShell Scripting and Modularization (TechMentor Fall 2011)
Concentrated Technology
 
PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)
Concentrated Technology
 

Viewers also liked (20)

PowerShell Scripting and Modularization (TechMentor Fall 2011)
PowerShell Scripting and Modularization (TechMentor Fall 2011)PowerShell Scripting and Modularization (TechMentor Fall 2011)
PowerShell Scripting and Modularization (TechMentor Fall 2011)
 
PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)
 
10 PowerShell Mistakes, Trips and Traps
10 PowerShell Mistakes, Trips and Traps10 PowerShell Mistakes, Trips and Traps
10 PowerShell Mistakes, Trips and Traps
 
Power shell training
Power shell trainingPower shell training
Power shell training
 
Wsv315 Windows Power Shell For Beginners
Wsv315 Windows Power Shell For BeginnersWsv315 Windows Power Shell For Beginners
Wsv315 Windows Power Shell For Beginners
 
Wsv406 Advanced Automation Using Windows Power Shell2.0
Wsv406 Advanced Automation Using Windows Power Shell2.0Wsv406 Advanced Automation Using Windows Power Shell2.0
Wsv406 Advanced Automation Using Windows Power Shell2.0
 
Everything you need to know about PowerShell
Everything you need to know about PowerShellEverything you need to know about PowerShell
Everything you need to know about PowerShell
 
Windows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementWindows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server Management
 
VMUG - Mastering PowerShell to Call RESTful API Endpoints
VMUG - Mastering PowerShell to Call RESTful API EndpointsVMUG - Mastering PowerShell to Call RESTful API Endpoints
VMUG - Mastering PowerShell to Call RESTful API Endpoints
 
Unlock The Value Of Your Microsoft and SAP Investments
Unlock The Value Of Your Microsoft and SAP InvestmentsUnlock The Value Of Your Microsoft and SAP Investments
Unlock The Value Of Your Microsoft and SAP Investments
 
Change document display
Change document displayChange document display
Change document display
 
Workshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte IWorkshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte I
 
Workshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensionesWorkshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensiones
 
CDS Unit Testing
CDS Unit TestingCDS Unit Testing
CDS Unit Testing
 
Workshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototypingWorkshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototyping
 
Workshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operatorsWorkshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operators
 
Hana sql
Hana sql Hana sql
Hana sql
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
 
Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
 
JavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional ProgrammingJavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional Programming
 

Similar to Introduction To Power Shell

Unit 11 configuring the bash shell – shell script
Unit 11 configuring the bash shell – shell scriptUnit 11 configuring the bash shell – shell script
Unit 11 configuring the bash shell – shell script
root_fibo
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
PHPPRO
 
PowerShell_LangRef_v3 (1).pdf
PowerShell_LangRef_v3 (1).pdfPowerShell_LangRef_v3 (1).pdf
PowerShell_LangRef_v3 (1).pdf
outcast96
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
Raghu nath
 
Using Unix
Using UnixUsing Unix
Using Unix
Dr.Ravi
 
Powershell Tech Ed2009
Powershell Tech Ed2009Powershell Tech Ed2009
Powershell Tech Ed2009
rsnarayanan
 

Similar to Introduction To Power Shell (20)

SVCC 5 introduction to powershell
SVCC 5 introduction to powershellSVCC 5 introduction to powershell
SVCC 5 introduction to powershell
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Evil
 
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.ppt
 
PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101
 
Unit 11 configuring the bash shell – shell script
Unit 11 configuring the bash shell – shell scriptUnit 11 configuring the bash shell – shell script
Unit 11 configuring the bash shell – shell script
 
The Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shellThe Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shell
 
Powershell notes
Powershell notesPowershell notes
Powershell notes
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
 
PowerShell_LangRef_v3 (1).pdf
PowerShell_LangRef_v3 (1).pdfPowerShell_LangRef_v3 (1).pdf
PowerShell_LangRef_v3 (1).pdf
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell Scripting
 
Licão 09 variables and arrays v2
Licão 09 variables and arrays v2Licão 09 variables and arrays v2
Licão 09 variables and arrays v2
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Introduction to windows power shell in sharepoint 2010
Introduction to windows power shell in sharepoint 2010Introduction to windows power shell in sharepoint 2010
Introduction to windows power shell in sharepoint 2010
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
 
Using Unix
Using UnixUsing Unix
Using Unix
 
PHP and COM
PHP and COMPHP and COM
PHP and COM
 
Powershell Tech Ed2009
Powershell Tech Ed2009Powershell Tech Ed2009
Powershell Tech Ed2009
 

Recently uploaded

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 

Recently uploaded (20)

Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 

Introduction To Power Shell

  • 1. Introduction to PowerShell Ivan Suhinin Senior Software Engineer
  • 2. What is PowerShell? Automation engine Shell environment Scripting language
  • 3. PowerShell as a shell A full replacement for CMD At last something bash-like in Windows Just… feel the power!
  • 4. PowerShell as a language Variables: $a, $name Arrays: $arr = 1,2,3,4,5,6; $sarr=1..6 Hashes: $h = @{“Key1" = 23; “Key2" = 894} Functions: function hi ($name) { echo "Hi, $name!" } Classes:($o = New-Object Object) |Add-Member NoteProperty Name “Bianco"
  • 5. PowerShell as an automation tool Predefined set of commands with lots of extensions Easy batch operations Simple command interconnections (pipelining)
  • 6. Command types Cmdlets – Get-Location Functions User scripts - *.ps1 Native applications (msbuild, csc)
  • 7. Cmdlets Predefined set of commands Form: Verb-Noun: Get-Location Get-ChildItem Set-Location Long, descriptive names for scripts Aliases for daily usage
  • 8. Aliases Creating short names for long cmdlets Get-Alias, Set-Alias Makes scripting more friendly By default has standard UNIX aliases ls, ps, pwd, date, kill, gal, pushd, popd
  • 9. Wiring commands up Pipelining: Get-Location | Get-Member Functional style .NET objects instead of strings (bash) Output becomes input Select – selecting only needed information Where – filtering results Group – grouping results ForEach – processing each input value
  • 10. PowerShell providers Adapters to different subsystems Get-PSProvider, Get-PSDrive Default: WSMan, Alias, Environment, FileSystem, Registry Extended: IIS, SQL, SharePoint, VMWare
  • 11. Using external components Windows Management Instrumentation (WMI) gwmi win32_service gwmi win32_operatingsystem COM (New-Object -ComObjectWScript.Shell).Run("calc.exe")
  • 12. Using .NET Importing assemblies:[Reflection.Assembly]::LoadWithPartialName("System.Messaging") Calling static methods:[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("localhost") Creating and using objects:$b = New-Object System.Text.StringBuilder$b.Append("Hello!")
  • 13. man Ultimate help system Examples Detailed Full
  • 15. Demo: sorting SQL tables by size
  • 17. Development environment Autocompletion Tab key Wildcards Works for methods PowerShell ISE PowerGUI
  • 18. Q & A