SlideShare una empresa de Scribd logo
1 de 25
Introduction to PowerShellLearn it before it become URGENT Salaudeen.Rajack@Gmail.com Blog: http://www.Salaudeen.Blogspot.com
Agenda What is PowerShell ? Problems with existing scripting language (VB script) How PowerShell solves the security issues Basic commands in Powershell GUI (IDE) for Powershell How to get help in PowerShell Alias Snap-ins Cmd-lets in PowerShell Variables Understanding the pipe line Operators in PowerShell Logical Operators Sorting, Measuring, Select, Filter and compare Export, Import, Convert Functions  Regular expressions Arrays and Hash Table XML handling
What is PowerShell? NEW scripting platform for Microsoft products One scripting language – Multiple products Windows Desktop OS, Server OS SharePoint SQL Server SCOM/SCDPM/SVCMM Exchange Server VMWARE/Citrix  Runs on top of .net framework, 2.0+ Automate almost every thing you can do with GUI (some times, things which are not possible with GUI) Not just command prompt or Script language, But Command-Shell. It’s the Microsoft Way… Shell prompt, just like DOS shell, But more powerful
Restricted - No scripting allowed  unrestricted - You can any scripting ,[object Object],Remote signed – good for test, dev environments only files from internet need to be signed default setting All signed  - local, remote script, it should be signed. user must agree to run script PowerShell’s Execution Policy
No common scripting for all the products .Net code COM Model Exe VBScript Scripts are really security concern, because they do have lot of power Echo “Welcome” Del *.* ??? Top Concerns: Integrity Identity Double click Run Command Hijacking PowerShell addresses this issue by introducing Executing Policy Problems with Existing scripting languages
“built-in” commands for PowerShell “verb-noun” names eg. get-childitem (= ls) but: new-alias, new-object extensible set: can write own cmdlets Heart and Soul of PowerShell Engine that make powershell work. They are the small units of functionality that perform the operations. Cmdlets
Basic Tour Shell prompt Help system Getting help: Get-help Get-help –verb get Get-help –noun file Get-help  stop-process –examples Get-help  stop-process –full Get-help “sp* Out-file Ps>file1.txt     ps>>file2.txt Ps |out-file process.txt Get-content
Snap-In Powershell snap-in provides a mechanism for registering sets of cmdlets Example: similar to MMC  Set of cmd-lets for a specific product	 Eg. SharePoint Get-pssnapin Lists the core functionality Get-Pssnapin – registered Shows the installed cmd-Lets To Add a new PS Snapin: Add-Snapin <snap-in-Name>
Basic cmd-lets for process, services Ask Help: help *process* Get-process  > Alias ps Eg. Get-process –name  calc How to get the –name parameter?  Get-process | get-member Stop-process -> Alias Kill Stop-process –name calc  Stop-process –name calc –whatif Services Get-service <service name> Restart-service <service name> Stop-service <service name>
Basic cmd-lets for process, services (Cont.) Get-service –include “Sharepoint*” Get-service –exclude “Sharepoint*” Event log: Get-eventlog Eg. get-eventlog system –newest 10 Get-eventlog | -newest 10 format-list IDE PowerGUI - Open source yet powerfull, FREE Powershell +  Primal script  ISE – PowerShell 2.0
Variables	 Powershell assigns best suited data type for variables when assigned New-variable  -name var –value 10 Or $var=10 Remove-variable –name var It supports Int, Datetime, Bool, string, Char, byte, decimal, array, xml Variables are actually .net objects $test=“honeywell” Can say $test.toUpper() User get-member to retrieve all the member of the object Can force the data type by  [string]$var=5 $var.gettype().fullname
Pipelines Commands manipulates and passes objects from One to another Eg: Get the list of process -> filter > stop ->format Get-process | where-object {$_.status –eq “Stopped”} |format-list Get-process | out-file C:rocess.txt Get-process | out-Printer <Name of the printer> Write-output vs write-host First one sends output to the pipeline, Second doesn’t Write-output “Hello” |where-object {$_.length – gt 2} We have some additional options like –foregroundcolor D C D A
Operators All Basic math operations: +, -, *, /, % 5+5; 10-1; 8*2; 10%3; 5+(5*5) Comparison EQ 10 –eq 5 LT, -GT, -GE, -LE String comparison: not case sensitive “Hello” – eq “HELLO” > true Forcing case sensitive: “Hello” – ceq “HELLO” > true Logical operators  AND OR NOT
Sort – Measure –Select - filter Sort Get-process | sort-object VM –desc Get-service |sort status Measure Get-service |measure-object Get-service |measure-object –property VM –sum –min-max –average Select Get-service | select-object displayname,status Get-process | select-object –first 10
Export-Import and compare Export-CSV Get-process |export-csv Export-CSV $process=import-csv c:a.csv Compare: $p1=get-process Now open a new process, say calc $p2=get-process Compare-object $p1, $p2 –property name
Logical constructs IF, Switch, For, While IF, Switch – Decision For, while – looping Eg  IF($var –gt 100)  { write-host “yes”} Elseif() { } Else { }
Logical constructs Switch eg $company =“Honeywell” Switch($var) { “Wipro” {write-host “wipro”} “Honeywell” {write-host “wipro”} Default {write-host “Not in list”} }
While While, Do…Until, Do..while $var=1 While($var – lt 10) 	{ 	write-host $var $var++ } For-each Eg.	 $services=get-service Foreach($x in $services) { write-host $x.name.toupper() }
Script Block Executes the block of code from file, variable $b={write-host “Hello”} $b >>write-host “hello” To Execute : &$b Functions: Function sayHello() {   write-host “Hello” } sayHello
Functions Cont. Function sayHello($SenderName) {   write-host “Hello” + $senderName } sayHello “Honeywell” ,[object Object],Return statement: 	function determine {  if($var – gt 10) {return $true} Else {return $false} }
Regular expression Standard for Pattern matching Use –Match Eg. 	“Honeywell” –match “Honey” . (dot) – one char * - Zero or more match   “A” match “t*” + - one or more match “TTT” match “^T+” ? – Zero or one match [AB] – either A or B ^ - start  $ - end  eg. “Sala” –match “^s..A$”  – any word character  -W –Non word  – space    -S    -D (n,m) eg. “TTTT” –match “^T{4, 6}”
Strings, Arrays, Hash tables $H=“Honeywell” $h.length Say “hello” >> “Say “”hello””” Array:  $arr=1,2,3  or $arr=@(1,2,3) $arr2=@((1,1),(2,2),(3,3)) Get : $arr2[1][1] Hash table: $Hash=@{No=1;”CName“=“Honeywell”} $hash.no $hash[“Cname”]
XML $MyXML=[XML] @” <addressBook> <Person type=“personal”> <name>ABC</name> <Phone>123</phone> </person> </addressbook> “@ $myXML.AddressBook $myXML.Person $myXML.Person[0]
Resources Download powershell through Microsoft.com Videos http://channel9.msdn.com/Media/?TagID=163 Blogs http://blogs.msdn.com/powershell http://thepowershellguy.com http://keithhill.spaces.live.com http://www.leeholmes.com/blog PowerShell Installation Instructions: http://shrinkster.com/rpy PowerTab by MoW - http://shrinkster.com/rpx “MSH Logo” by Lee Holmes - http://shrinkster.com/rpw PowerShell Community Extensions http://www.codeplex.com/PowerShellCX MSDN - http://shrinkster.com/rpu How to create a cmdlet: http://shrinkster.com/rpv Blogs PowerShell Team Blog - http://blogs.msdn.com/powershell/ Lee Holmes - http://www.leeholmes.com/blog/ David Aiken - http://blogs.msdn.com/daiken/ The PowerShell Guy (MoW) - http://thepowershellguy.com/ Popular Newsgroup microsoft.public.windows.powershell
Thank you Salaudeen.Rajack@Gmail.com Blog: http://www.Salaudeen.Blogspot.com

Más contenido relacionado

La actualidad más candente

WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEHitesh Mohapatra
 
Writing Redis in Python with asyncio
Writing Redis in Python with asyncioWriting Redis in Python with asyncio
Writing Redis in Python with asyncioJames Saryerwinnie
 
ColdFusion ORM - Advanced : Adobe Max 2009
ColdFusion ORM - Advanced : Adobe Max 2009ColdFusion ORM - Advanced : Adobe Max 2009
ColdFusion ORM - Advanced : Adobe Max 2009Rupesh Kumar
 
How to perform debounce in react
How to perform debounce in reactHow to perform debounce in react
How to perform debounce in reactBOSC Tech Labs
 
Professional Help for PowerShell Modules
Professional Help for PowerShell ModulesProfessional Help for PowerShell Modules
Professional Help for PowerShell ModulesJune Blender
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebeanFaren faren
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPAFaren faren
 
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian DammOSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian DammNETWAYS
 
Hw09 Monitoring Best Practices
Hw09   Monitoring Best PracticesHw09   Monitoring Best Practices
Hw09 Monitoring Best PracticesCloudera, Inc.
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerKidong Lee
 
PowerShell Fundamentals
PowerShell FundamentalsPowerShell Fundamentals
PowerShell Fundamentalsmozdzen
 
Introduction to Powershell Version 5
Introduction to Powershell Version 5Introduction to Powershell Version 5
Introduction to Powershell Version 5Nishtha Kesarwani
 
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Mасштабирование микросервисов на Go, Matt Heath (Hailo)Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Mасштабирование микросервисов на Go, Matt Heath (Hailo)Ontico
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascriptEldar Djafarov
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliGetSource
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimizationxiaojueqq12345
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01longtuan
 
CPAN 模組二三事
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事Lin Yo-An
 

La actualidad más candente (20)

WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
 
Powershell Demo Presentation
Powershell Demo PresentationPowershell Demo Presentation
Powershell Demo Presentation
 
Writing Redis in Python with asyncio
Writing Redis in Python with asyncioWriting Redis in Python with asyncio
Writing Redis in Python with asyncio
 
ColdFusion ORM - Advanced : Adobe Max 2009
ColdFusion ORM - Advanced : Adobe Max 2009ColdFusion ORM - Advanced : Adobe Max 2009
ColdFusion ORM - Advanced : Adobe Max 2009
 
How to perform debounce in react
How to perform debounce in reactHow to perform debounce in react
How to perform debounce in react
 
Professional Help for PowerShell Modules
Professional Help for PowerShell ModulesProfessional Help for PowerShell Modules
Professional Help for PowerShell Modules
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebean
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPA
 
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian DammOSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
 
Hw09 Monitoring Best Practices
Hw09   Monitoring Best PracticesHw09   Monitoring Best Practices
Hw09 Monitoring Best Practices
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
 
SmokeTests
SmokeTestsSmokeTests
SmokeTests
 
PowerShell Fundamentals
PowerShell FundamentalsPowerShell Fundamentals
PowerShell Fundamentals
 
Introduction to Powershell Version 5
Introduction to Powershell Version 5Introduction to Powershell Version 5
Introduction to Powershell Version 5
 
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Mасштабирование микросервисов на Go, Matt Heath (Hailo)Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascript
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimization
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01
 
CPAN 模組二三事
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事
 

Destacado

Basic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 sessionBasic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 sessionRob Dunn
 
PowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationPowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationJason Stangroome
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administrationConcentrated Technology
 
PowerShell and the Future of Windows Automation
PowerShell and the Future of Windows AutomationPowerShell and the Future of Windows Automation
PowerShell and the Future of Windows AutomationConcentrated Technology
 
Managing enterprise with PowerShell remoting
Managing enterprise with PowerShell remotingManaging enterprise with PowerShell remoting
Managing enterprise with PowerShell remotingConcentrated Technology
 
Advanced Tools & Scripting with PowerShell 3.0 Jump Start - Certificate
Advanced Tools & Scripting with PowerShell 3.0 Jump Start - CertificateAdvanced Tools & Scripting with PowerShell 3.0 Jump Start - Certificate
Advanced Tools & Scripting with PowerShell 3.0 Jump Start - CertificateDon Reese
 
Automating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellAutomating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellConcentrated Technology
 
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and UsesVDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and UsesConcentrated Technology
 
PowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsPowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsConcentrated Technology
 
Ive got a powershell secret
Ive got a powershell secretIve got a powershell secret
Ive got a powershell secretChris Conte
 

Destacado (20)

PowerShell crash course
PowerShell crash coursePowerShell crash course
PowerShell crash course
 
Basic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 sessionBasic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 session
 
PS error handling and debugging
PS error handling and debuggingPS error handling and debugging
PS error handling and debugging
 
Ha & drs gotcha's
Ha & drs gotcha'sHa & drs gotcha's
Ha & drs gotcha's
 
PowerShell 8tips
PowerShell 8tipsPowerShell 8tips
PowerShell 8tips
 
Implementing dr w. hyper v clustering
Implementing dr w. hyper v clusteringImplementing dr w. hyper v clustering
Implementing dr w. hyper v clustering
 
Meet Windows PowerShell
Meet Windows PowerShellMeet Windows PowerShell
Meet Windows PowerShell
 
PowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationPowerShell v4 Desired State Configuration
PowerShell v4 Desired State Configuration
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administration
 
PowerShell and the Future of Windows Automation
PowerShell and the Future of Windows AutomationPowerShell and the Future of Windows Automation
PowerShell and the Future of Windows Automation
 
Managing enterprise with PowerShell remoting
Managing enterprise with PowerShell remotingManaging enterprise with PowerShell remoting
Managing enterprise with PowerShell remoting
 
Server Core2
Server Core2Server Core2
Server Core2
 
Advanced Tools & Scripting with PowerShell 3.0 Jump Start - Certificate
Advanced Tools & Scripting with PowerShell 3.0 Jump Start - CertificateAdvanced Tools & Scripting with PowerShell 3.0 Jump Start - Certificate
Advanced Tools & Scripting with PowerShell 3.0 Jump Start - Certificate
 
No-script PowerShell v2
No-script PowerShell v2No-script PowerShell v2
No-script PowerShell v2
 
Automating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellAutomating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShell
 
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and UsesVDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and Uses
 
PowerShell and WMI
PowerShell and WMIPowerShell and WMI
PowerShell and WMI
 
Combining output from multiple sources
Combining output from multiple sourcesCombining output from multiple sources
Combining output from multiple sources
 
PowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsPowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint admins
 
Ive got a powershell secret
Ive got a powershell secretIve got a powershell secret
Ive got a powershell secret
 

Similar a Introduction to powershell

Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellSalaudeen Rajack
 
NIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellNIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellPhan Hien
 
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 2010Binh Nguyen
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubEssam Salah
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersBoulos Dib
 
Windows power shell basics
Windows power shell basicsWindows power shell basics
Windows power shell basicsDan Morrill
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingRavikanth Chaganti
 
NZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNick Hadlee
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
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
 
Introduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShellIntroduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShellHal Rottenberg
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellSharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellSharePoint Saturday NY
 
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 Eviljaredhaight
 
SharePoint Administration with PowerShell
SharePoint Administration with PowerShellSharePoint Administration with PowerShell
SharePoint Administration with PowerShellEric Kraus
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineBehzod Saidov
 
Sunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil Phani
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Hitesh Mohapatra
 
AutoScaling and Drupal
AutoScaling and DrupalAutoScaling and Drupal
AutoScaling and DrupalPromet Source
 

Similar a Introduction to powershell (20)

Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
NIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellNIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShell
 
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 Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge Club
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
 
Windows power shell basics
Windows power shell basicsWindows power shell basics
Windows power shell basics
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell Scripting
 
NZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePoint
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)
 
Introduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShellIntroduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShell
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with 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
 
SharePoint Administration with PowerShell
SharePoint Administration with PowerShellSharePoint Administration with PowerShell
SharePoint Administration with PowerShell
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
 
Sunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil phani's take on windows powershell
Sunil phani's take on windows powershell
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...
 
AutoScaling and Drupal
AutoScaling and DrupalAutoScaling and Drupal
AutoScaling and Drupal
 
Admin share point with powershell
Admin share point with powershellAdmin share point with powershell
Admin share point with powershell
 

Último

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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 educationjfdjdjcjdnsjd
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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 RobisonAnna Loughnan Colquhoun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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...Neo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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 textsMaria Levchenko
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Último (20)

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL 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...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Introduction to powershell

  • 1. Introduction to PowerShellLearn it before it become URGENT Salaudeen.Rajack@Gmail.com Blog: http://www.Salaudeen.Blogspot.com
  • 2. Agenda What is PowerShell ? Problems with existing scripting language (VB script) How PowerShell solves the security issues Basic commands in Powershell GUI (IDE) for Powershell How to get help in PowerShell Alias Snap-ins Cmd-lets in PowerShell Variables Understanding the pipe line Operators in PowerShell Logical Operators Sorting, Measuring, Select, Filter and compare Export, Import, Convert Functions Regular expressions Arrays and Hash Table XML handling
  • 3. What is PowerShell? NEW scripting platform for Microsoft products One scripting language – Multiple products Windows Desktop OS, Server OS SharePoint SQL Server SCOM/SCDPM/SVCMM Exchange Server VMWARE/Citrix Runs on top of .net framework, 2.0+ Automate almost every thing you can do with GUI (some times, things which are not possible with GUI) Not just command prompt or Script language, But Command-Shell. It’s the Microsoft Way… Shell prompt, just like DOS shell, But more powerful
  • 4.
  • 5. No common scripting for all the products .Net code COM Model Exe VBScript Scripts are really security concern, because they do have lot of power Echo “Welcome” Del *.* ??? Top Concerns: Integrity Identity Double click Run Command Hijacking PowerShell addresses this issue by introducing Executing Policy Problems with Existing scripting languages
  • 6. “built-in” commands for PowerShell “verb-noun” names eg. get-childitem (= ls) but: new-alias, new-object extensible set: can write own cmdlets Heart and Soul of PowerShell Engine that make powershell work. They are the small units of functionality that perform the operations. Cmdlets
  • 7. Basic Tour Shell prompt Help system Getting help: Get-help Get-help –verb get Get-help –noun file Get-help stop-process –examples Get-help stop-process –full Get-help “sp* Out-file Ps>file1.txt ps>>file2.txt Ps |out-file process.txt Get-content
  • 8. Snap-In Powershell snap-in provides a mechanism for registering sets of cmdlets Example: similar to MMC Set of cmd-lets for a specific product Eg. SharePoint Get-pssnapin Lists the core functionality Get-Pssnapin – registered Shows the installed cmd-Lets To Add a new PS Snapin: Add-Snapin <snap-in-Name>
  • 9. Basic cmd-lets for process, services Ask Help: help *process* Get-process > Alias ps Eg. Get-process –name calc How to get the –name parameter? Get-process | get-member Stop-process -> Alias Kill Stop-process –name calc Stop-process –name calc –whatif Services Get-service <service name> Restart-service <service name> Stop-service <service name>
  • 10. Basic cmd-lets for process, services (Cont.) Get-service –include “Sharepoint*” Get-service –exclude “Sharepoint*” Event log: Get-eventlog Eg. get-eventlog system –newest 10 Get-eventlog | -newest 10 format-list IDE PowerGUI - Open source yet powerfull, FREE Powershell + Primal script ISE – PowerShell 2.0
  • 11. Variables Powershell assigns best suited data type for variables when assigned New-variable -name var –value 10 Or $var=10 Remove-variable –name var It supports Int, Datetime, Bool, string, Char, byte, decimal, array, xml Variables are actually .net objects $test=“honeywell” Can say $test.toUpper() User get-member to retrieve all the member of the object Can force the data type by [string]$var=5 $var.gettype().fullname
  • 12. Pipelines Commands manipulates and passes objects from One to another Eg: Get the list of process -> filter > stop ->format Get-process | where-object {$_.status –eq “Stopped”} |format-list Get-process | out-file C:rocess.txt Get-process | out-Printer <Name of the printer> Write-output vs write-host First one sends output to the pipeline, Second doesn’t Write-output “Hello” |where-object {$_.length – gt 2} We have some additional options like –foregroundcolor D C D A
  • 13. Operators All Basic math operations: +, -, *, /, % 5+5; 10-1; 8*2; 10%3; 5+(5*5) Comparison EQ 10 –eq 5 LT, -GT, -GE, -LE String comparison: not case sensitive “Hello” – eq “HELLO” > true Forcing case sensitive: “Hello” – ceq “HELLO” > true Logical operators AND OR NOT
  • 14. Sort – Measure –Select - filter Sort Get-process | sort-object VM –desc Get-service |sort status Measure Get-service |measure-object Get-service |measure-object –property VM –sum –min-max –average Select Get-service | select-object displayname,status Get-process | select-object –first 10
  • 15. Export-Import and compare Export-CSV Get-process |export-csv Export-CSV $process=import-csv c:a.csv Compare: $p1=get-process Now open a new process, say calc $p2=get-process Compare-object $p1, $p2 –property name
  • 16. Logical constructs IF, Switch, For, While IF, Switch – Decision For, while – looping Eg IF($var –gt 100) { write-host “yes”} Elseif() { } Else { }
  • 17. Logical constructs Switch eg $company =“Honeywell” Switch($var) { “Wipro” {write-host “wipro”} “Honeywell” {write-host “wipro”} Default {write-host “Not in list”} }
  • 18. While While, Do…Until, Do..while $var=1 While($var – lt 10) { write-host $var $var++ } For-each Eg. $services=get-service Foreach($x in $services) { write-host $x.name.toupper() }
  • 19. Script Block Executes the block of code from file, variable $b={write-host “Hello”} $b >>write-host “hello” To Execute : &$b Functions: Function sayHello() { write-host “Hello” } sayHello
  • 20.
  • 21. Regular expression Standard for Pattern matching Use –Match Eg. “Honeywell” –match “Honey” . (dot) – one char * - Zero or more match “A” match “t*” + - one or more match “TTT” match “^T+” ? – Zero or one match [AB] – either A or B ^ - start $ - end eg. “Sala” –match “^s..A$” – any word character -W –Non word – space -S -D (n,m) eg. “TTTT” –match “^T{4, 6}”
  • 22. Strings, Arrays, Hash tables $H=“Honeywell” $h.length Say “hello” >> “Say “”hello””” Array: $arr=1,2,3 or $arr=@(1,2,3) $arr2=@((1,1),(2,2),(3,3)) Get : $arr2[1][1] Hash table: $Hash=@{No=1;”CName“=“Honeywell”} $hash.no $hash[“Cname”]
  • 23. XML $MyXML=[XML] @” <addressBook> <Person type=“personal”> <name>ABC</name> <Phone>123</phone> </person> </addressbook> “@ $myXML.AddressBook $myXML.Person $myXML.Person[0]
  • 24. Resources Download powershell through Microsoft.com Videos http://channel9.msdn.com/Media/?TagID=163 Blogs http://blogs.msdn.com/powershell http://thepowershellguy.com http://keithhill.spaces.live.com http://www.leeholmes.com/blog PowerShell Installation Instructions: http://shrinkster.com/rpy PowerTab by MoW - http://shrinkster.com/rpx “MSH Logo” by Lee Holmes - http://shrinkster.com/rpw PowerShell Community Extensions http://www.codeplex.com/PowerShellCX MSDN - http://shrinkster.com/rpu How to create a cmdlet: http://shrinkster.com/rpv Blogs PowerShell Team Blog - http://blogs.msdn.com/powershell/ Lee Holmes - http://www.leeholmes.com/blog/ David Aiken - http://blogs.msdn.com/daiken/ The PowerShell Guy (MoW) - http://thepowershellguy.com/ Popular Newsgroup microsoft.public.windows.powershell
  • 25. Thank you Salaudeen.Rajack@Gmail.com Blog: http://www.Salaudeen.Blogspot.com