SlideShare une entreprise Scribd logo
1  sur  100
What’s PowerShell
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 1
• Scripting Environment
• Scripting Language
• Windows equivalent of UNIX Shell Script (but even more powerful)
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 2
Interactive Shell
History
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 3
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 4
Versions
.Net Framework
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 5
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 6
Installing the latest version
https://www.microsoft.com/en-us/download/details.aspx?id=46889
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 7
ISE – The PowerShell IDE
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 8
Case Insensitive
Get-service
get-service
Get-Service
Installing/Accessing PowerShell
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 9
Updating the help in PowerShell
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 10
Get help in PowerShell
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 11
Get-Help
Execution Policy
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 12
Get & Set Cmdlets
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 13
Get-<Command>
Set-<Command>
Comments
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 14
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 15
Writing to Console
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 16
Clear Screen
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 17
Aliases
Variables
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 18
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 19
Data types
Pipelining
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 20
.Net objects passed down the pipeline
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 21
Listing directory Contents
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 22
Recursive listing
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 23
ErrorAction SilentlyContinue
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 24
Looping using Foreach-Object
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 25
Filtering using Where-Object
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 26
Sorting using Sort-Object
PowerShell v/s UNIX Shell
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 27
Assignment Operators
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 28
=
+=
-=
*=
/=
%=
++
--
Comparison Operators
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 29
-eq
-ne
-gt
-ge
-lt
-le
-replace
-contains
-notcontains
-in
-notin
-match
-notmatch
-like
-notlike
-is
-isnot
-as
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 30
Comparison Operators: -eq, -ne
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 31
Comparison Operators: -gt, -ge
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 32
Comparison Operators: -lt, -le
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 33
Comparison Operators: -replace
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 34
Comparison Operators: -contains,
-notcontains
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 35
Comparison Operators: -in, -notin
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 36
Comparison Operators: -match, -
notmatch
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 37
Comparison Operators: -like, -
notlike
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 38
Comparison Operators: -is, -isnot
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 39
Comparison Operators: -as
Logical Operators
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 40
Split, Join, foreach
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 41
Casting
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 42
Redirection Operators
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 43
Handling arrays
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 44
Dictionary/hash tables
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 45
Object Properties
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 46
Object Methods
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 47
String manipulation
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 48
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 49
Sorting Objects
PowerShell automatic variables
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 50
Searching filesystem using PS
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 51
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 52
Getting System processes
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 53
Getting list of services
Filtering objects
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 54
https://technet.microsoft.com/en-us/magazine/2007.04.powershell.aspx
http://windowsitpro.com/powershell/powershell-basics-filtering-objects
http://www.howtogeek.com/138324/geek-school-learning-formatting-filtering-and-comparing-in-
powershell/
http://searchwindowsserver.techtarget.com/feature/Filtering-output-from-Windows-PowerShell
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 55
Copying files/directories
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 56
Reading from file
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 57
Writing to file
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 58
Appending to a file
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 59
Deleting file/directory
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 60
Renaming a file/directory
Reading from Excel
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 61
Reading from CSV
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 62
Writing to CSV
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 63
Writing to Excel
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 64
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 65
Export-CSV
Reading large files
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 66
Exporting as CSV
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 67
Importing CSV
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 68
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 69
Appending to file
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 70
User defined Functions
http://windowsitpro.com/windows/create-your-own-powershell-functions
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 71
Param in functions
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 72
Passing parameters to functions
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 73
Parameters from Pipeline
Error Handling
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 74
Logging Error
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 75
Exception Handling
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 76
http://www.vexasoft.com/blogs/powershell/7255220-powershell-tutorial-try-catch-finally-and-
error-handling-in-powershell
http://blogs.msdn.com/b/kebab/archive/2013/06/09/an-introduction-to-error-handling-in-
powershell.aspx
http://blogs.technet.com/b/heyscriptingguy/archive/2014/07/09/handling-errors-the-
powershell-way.aspx
Output formatting
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 77
https://technet.microsoft.com/en-us/library/dd347677.aspx
https://technet.microsoft.com/en-us/magazine/2008.06.windowspowershell.aspx
http://www.computerperformance.co.uk/powershell/powershell_format_table.htm
http://www.computerperformance.co.uk/powershell/powershell_-f_format.htm
http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/23/format-powershell-output-with-
an-easy-to-use-table.aspx
http://windowsitpro.com/powershell/powershell-basics-formatting
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 78
Advanced formatting
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 79
Redirecting formatted output
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 80
Modules
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 81
Navigating the Registry
Regex
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 82
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 83
Starting a new Job
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 84
WMI
• Windows Management Interface
• Created by Microsoft
• Is Microsoft’s implementation of CIM
• CIM is the super class for WMI. Eq Win32_DiskDrive is derived from CIM_DiskDrive
• Doesn’t work with the routers, switches or other network devices
• Doesn’t support discoverabilty
WMI
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 85
http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/05/hey-scripting-guy-can-windows-
powershell-call-wmi-methods.aspx
http://www.computerperformance.co.uk/powershell/powershell_wmi.htm
http://www.darkoperator.com/blog/2013/2/6/introduction-to-wmi-basics-with-powershell-part-2-
exploring.html
http://www.lazywinadmin.com/2015/03/standard-and-advanced-powershell.html
WMI Administrative Tools
http://www.microsoft.com/en-us/download/details.aspx?id=24045
Windows COM (Component Object Model)
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 86
WMI Explorer
Download WMI Explorer from https://wmie.codeplex.com/
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 87
WQL (WMI Query Language)
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 88
CIM
• Common Information Model
• Set up by DTMF (Desktop Management Task Force)
• http://www.dmtf.org/standards/cim
• An open model compared to WMI
• Common model for managing systems, switches, routers and other n/w
devices
• Enables extension of the API by vendors
• The goal is to make PowerShell the platform to manage both windows & non-
windows
• Faster than WMI
“CIM provides a common definition of management information for systems,
networks, applications and services, and allows for vendor extensions. CIM’s
common definitions enable vendors to exchange semantically rich management
information between systems throughout the network.”
PS Provider
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 89
• Its an interface
• It makes any storage look like a disk drive
• Could be filesystem, registry
• Providers are used to create drives
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 90
https://technet.microsoft.com/en-us/library/ee126186(v=vs.85).aspx
https://technet.microsoft.com/en-us/library/dd315335.aspx
https://technet.microsoft.com/en-us/library/ee176857.aspx
PS Provider
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 91
PS Drive
A PowerShell Drive is some sort of a storage adapted to look like a disk drive
PS Drive
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 92
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 93
New-PSDrive
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 94
Administration Automation
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 95
Connecting to SQL Server
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 96
Creating Database, Tables in SQL
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 97
Importing data into SQL Server
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 98
Connecting to Remote machines
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 99
Importing libraries
Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 100
OOP in PowerShell
https://psclass.codeplex.com/

Contenu connexe

Similaire à PowerShell Slides

QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...
QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...
QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...
QAFest
 
QA fest - Web-magic of QA processes - Anton Kapitanenko - 2
QA fest - Web-magic of QA processes - Anton Kapitanenko - 2QA fest - Web-magic of QA processes - Anton Kapitanenko - 2
QA fest - Web-magic of QA processes - Anton Kapitanenko - 2
Anton Kapitanenko
 
S4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptx
S4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptxS4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptx
S4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptx
ITAdmin28
 

Similaire à PowerShell Slides (20)

How to publish your plugin as open source and contribute to WordPress
How to publish your plugin as open source and contribute to WordPressHow to publish your plugin as open source and contribute to WordPress
How to publish your plugin as open source and contribute to WordPress
 
Tutorial in LastPass
Tutorial in LastPassTutorial in LastPass
Tutorial in LastPass
 
Hyper v replication on windows server 2016 step by step
Hyper v replication on windows server 2016 step by stepHyper v replication on windows server 2016 step by step
Hyper v replication on windows server 2016 step by step
 
How to use Basecamp 3
How to use Basecamp 3How to use Basecamp 3
How to use Basecamp 3
 
QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...
QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...
QA Fest 2014. Антон Капитаненко. Web – магия qa процессов в (сверх-) высоко-н...
 
QA fest - Web-magic of QA processes - Anton Kapitanenko - 2
QA fest - Web-magic of QA processes - Anton Kapitanenko - 2QA fest - Web-magic of QA processes - Anton Kapitanenko - 2
QA fest - Web-magic of QA processes - Anton Kapitanenko - 2
 
Microsoft certification exams 70 533
Microsoft certification exams 70 533Microsoft certification exams 70 533
Microsoft certification exams 70 533
 
multi-mechanize testing certification
multi-mechanize testing certificationmulti-mechanize testing certification
multi-mechanize testing certification
 
Introduction to Amazon Route 53 Resolver for Hybrid Cloud (NET215) - AWS re:I...
Introduction to Amazon Route 53 Resolver for Hybrid Cloud (NET215) - AWS re:I...Introduction to Amazon Route 53 Resolver for Hybrid Cloud (NET215) - AWS re:I...
Introduction to Amazon Route 53 Resolver for Hybrid Cloud (NET215) - AWS re:I...
 
How to use Google Docs
How to use Google DocsHow to use Google Docs
How to use Google Docs
 
SAP Performance Testing Using LoadRunner
SAP Performance Testing Using LoadRunnerSAP Performance Testing Using LoadRunner
SAP Performance Testing Using LoadRunner
 
SAP Performance Testing Using LoadRunner
SAP Performance Testing Using LoadRunnerSAP Performance Testing Using LoadRunner
SAP Performance Testing Using LoadRunner
 
V mware v center converter standalone user's guide
V mware v center converter standalone user's guideV mware v center converter standalone user's guide
V mware v center converter standalone user's guide
 
Cocktail of Environments. How to Mix Test and Development Environments and St...
Cocktail of Environments. How to Mix Test and Development Environments and St...Cocktail of Environments. How to Mix Test and Development Environments and St...
Cocktail of Environments. How to Mix Test and Development Environments and St...
 
vRealize Operation 7.5 What's new
vRealize Operation 7.5 What's newvRealize Operation 7.5 What's new
vRealize Operation 7.5 What's new
 
Advanced automated visual testing at DrupalCon Europe 2020
Advanced automated visual testing at DrupalCon Europe 2020Advanced automated visual testing at DrupalCon Europe 2020
Advanced automated visual testing at DrupalCon Europe 2020
 
S4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptx
S4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptxS4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptx
S4H_790 IAM - Authorization Concept Guidelines for S4HANA Cloud.pptx
 
CODE BLUE 2014 : マルウエアによる検出回避方法の解説 by 篠塚 大志 HIROSHI SHINOTSUKA
CODE BLUE 2014 : マルウエアによる検出回避方法の解説 by 篠塚 大志 HIROSHI SHINOTSUKACODE BLUE 2014 : マルウエアによる検出回避方法の解説 by 篠塚 大志 HIROSHI SHINOTSUKA
CODE BLUE 2014 : マルウエアによる検出回避方法の解説 by 篠塚 大志 HIROSHI SHINOTSUKA
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”
 
Advanced automated visual testing - DrupalCon seattle 2019
Advanced automated visual testing - DrupalCon seattle 2019Advanced automated visual testing - DrupalCon seattle 2019
Advanced automated visual testing - DrupalCon seattle 2019
 

PowerShell Slides

  • 1. What’s PowerShell Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 1 • Scripting Environment • Scripting Language • Windows equivalent of UNIX Shell Script (but even more powerful)
  • 2. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 2 Interactive Shell
  • 3. History Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 3
  • 4. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 4 Versions
  • 5. .Net Framework Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 5
  • 6. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 6 Installing the latest version https://www.microsoft.com/en-us/download/details.aspx?id=46889
  • 7. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 7 ISE – The PowerShell IDE
  • 8. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 8 Case Insensitive Get-service get-service Get-Service
  • 9. Installing/Accessing PowerShell Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 9
  • 10. Updating the help in PowerShell Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 10
  • 11. Get help in PowerShell Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 11 Get-Help
  • 12. Execution Policy Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 12
  • 13. Get & Set Cmdlets Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 13 Get-<Command> Set-<Command>
  • 14. Comments Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 14
  • 15. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 15 Writing to Console
  • 16. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 16 Clear Screen
  • 17. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 17 Aliases
  • 18. Variables Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 18
  • 19. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 19 Data types
  • 20. Pipelining Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 20 .Net objects passed down the pipeline
  • 21. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 21 Listing directory Contents
  • 22. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 22 Recursive listing
  • 23. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 23 ErrorAction SilentlyContinue
  • 24. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 24 Looping using Foreach-Object
  • 25. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 25 Filtering using Where-Object
  • 26. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 26 Sorting using Sort-Object
  • 27. PowerShell v/s UNIX Shell Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 27
  • 28. Assignment Operators Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 28 = += -= *= /= %= ++ --
  • 29. Comparison Operators Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 29 -eq -ne -gt -ge -lt -le -replace -contains -notcontains -in -notin -match -notmatch -like -notlike -is -isnot -as
  • 30. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 30 Comparison Operators: -eq, -ne
  • 31. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 31 Comparison Operators: -gt, -ge
  • 32. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 32 Comparison Operators: -lt, -le
  • 33. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 33 Comparison Operators: -replace
  • 34. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 34 Comparison Operators: -contains, -notcontains
  • 35. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 35 Comparison Operators: -in, -notin
  • 36. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 36 Comparison Operators: -match, - notmatch
  • 37. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 37 Comparison Operators: -like, - notlike
  • 38. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 38 Comparison Operators: -is, -isnot
  • 39. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 39 Comparison Operators: -as
  • 40. Logical Operators Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 40
  • 41. Split, Join, foreach Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 41
  • 42. Casting Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 42
  • 43. Redirection Operators Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 43
  • 44. Handling arrays Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 44
  • 45. Dictionary/hash tables Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 45
  • 46. Object Properties Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 46
  • 47. Object Methods Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 47
  • 48. String manipulation Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 48
  • 49. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 49 Sorting Objects
  • 50. PowerShell automatic variables Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 50
  • 51. Searching filesystem using PS Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 51
  • 52. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 52 Getting System processes
  • 53. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 53 Getting list of services
  • 54. Filtering objects Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 54 https://technet.microsoft.com/en-us/magazine/2007.04.powershell.aspx http://windowsitpro.com/powershell/powershell-basics-filtering-objects http://www.howtogeek.com/138324/geek-school-learning-formatting-filtering-and-comparing-in- powershell/ http://searchwindowsserver.techtarget.com/feature/Filtering-output-from-Windows-PowerShell
  • 55. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 55 Copying files/directories
  • 56. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 56 Reading from file
  • 57. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 57 Writing to file
  • 58. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 58 Appending to a file
  • 59. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 59 Deleting file/directory
  • 60. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 60 Renaming a file/directory
  • 61. Reading from Excel Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 61
  • 62. Reading from CSV Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 62
  • 63. Writing to CSV Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 63
  • 64. Writing to Excel Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 64
  • 65. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 65 Export-CSV
  • 66. Reading large files Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 66
  • 67. Exporting as CSV Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 67
  • 68. Importing CSV Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 68
  • 69. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 69 Appending to file
  • 70. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 70 User defined Functions http://windowsitpro.com/windows/create-your-own-powershell-functions
  • 71. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 71 Param in functions
  • 72. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 72 Passing parameters to functions
  • 73. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 73 Parameters from Pipeline
  • 74. Error Handling Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 74
  • 75. Logging Error Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 75
  • 76. Exception Handling Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 76 http://www.vexasoft.com/blogs/powershell/7255220-powershell-tutorial-try-catch-finally-and- error-handling-in-powershell http://blogs.msdn.com/b/kebab/archive/2013/06/09/an-introduction-to-error-handling-in- powershell.aspx http://blogs.technet.com/b/heyscriptingguy/archive/2014/07/09/handling-errors-the- powershell-way.aspx
  • 77. Output formatting Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 77 https://technet.microsoft.com/en-us/library/dd347677.aspx https://technet.microsoft.com/en-us/magazine/2008.06.windowspowershell.aspx http://www.computerperformance.co.uk/powershell/powershell_format_table.htm http://www.computerperformance.co.uk/powershell/powershell_-f_format.htm http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/23/format-powershell-output-with- an-easy-to-use-table.aspx http://windowsitpro.com/powershell/powershell-basics-formatting
  • 78. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 78 Advanced formatting
  • 79. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 79 Redirecting formatted output
  • 80. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 80 Modules
  • 81. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 81 Navigating the Registry
  • 82. Regex Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 82
  • 83. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 83 Starting a new Job
  • 84. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 84 WMI • Windows Management Interface • Created by Microsoft • Is Microsoft’s implementation of CIM • CIM is the super class for WMI. Eq Win32_DiskDrive is derived from CIM_DiskDrive • Doesn’t work with the routers, switches or other network devices • Doesn’t support discoverabilty
  • 85. WMI Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 85 http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/05/hey-scripting-guy-can-windows- powershell-call-wmi-methods.aspx http://www.computerperformance.co.uk/powershell/powershell_wmi.htm http://www.darkoperator.com/blog/2013/2/6/introduction-to-wmi-basics-with-powershell-part-2- exploring.html http://www.lazywinadmin.com/2015/03/standard-and-advanced-powershell.html WMI Administrative Tools http://www.microsoft.com/en-us/download/details.aspx?id=24045 Windows COM (Component Object Model)
  • 86. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 86 WMI Explorer Download WMI Explorer from https://wmie.codeplex.com/
  • 87. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 87 WQL (WMI Query Language)
  • 88. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 88 CIM • Common Information Model • Set up by DTMF (Desktop Management Task Force) • http://www.dmtf.org/standards/cim • An open model compared to WMI • Common model for managing systems, switches, routers and other n/w devices • Enables extension of the API by vendors • The goal is to make PowerShell the platform to manage both windows & non- windows • Faster than WMI “CIM provides a common definition of management information for systems, networks, applications and services, and allows for vendor extensions. CIM’s common definitions enable vendors to exchange semantically rich management information between systems throughout the network.”
  • 89. PS Provider Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 89 • Its an interface • It makes any storage look like a disk drive • Could be filesystem, registry • Providers are used to create drives
  • 90. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 90 https://technet.microsoft.com/en-us/library/ee126186(v=vs.85).aspx https://technet.microsoft.com/en-us/library/dd315335.aspx https://technet.microsoft.com/en-us/library/ee176857.aspx PS Provider
  • 91. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 91 PS Drive A PowerShell Drive is some sort of a storage adapted to look like a disk drive
  • 92. PS Drive Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 92
  • 93. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 93 New-PSDrive
  • 94. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 94 Administration Automation
  • 95. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 95 Connecting to SQL Server
  • 96. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 96 Creating Database, Tables in SQL
  • 97. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 97 Importing data into SQL Server
  • 98. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 98 Connecting to Remote machines
  • 99. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 99 Importing libraries
  • 100. Varun Varghese +91 9986599326 varunmuriyanat@gmail.com 100 OOP in PowerShell https://psclass.codeplex.com/