SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Windows PowerShell
Sandun Perera
Geveo Australasia
30th May 2012
 Command line interpreter
 Unix shell
 Apple script
 MS-DOS
 Windows Script Host
 Windows PowerShell
 Administrative tasks
 Routine tasks
 Maintenance tasks
Shell scripting
 1. Install Microsoft .NET Framework 2.0
 2. Install Microsoft .NET Framework 3.5.1.
 Required for Windows PowerShell Integrated Scripting
Environment (ISE) and Out-GridView.
 3. Install WinRM 2.0 CTP3. (Windows Remote Shell)
 This is required if you want to take advantage of the remoting and
back- ground jobs features.
 4. Install Windows PowerShell 2.
Starting point (ps2)
Integrated Scripting Environment
(ISE)
 Set Execution Policy
 Customise Console
 Profile editing
 Profile using
Permission and Profiling
Cmdlets
Windows
PowerShell
(Cmdlet)
Windows PowerShell
(Alias)
cmd.exe /
COMMAND.COM
(MS-DOS, Windows,
OS/2, etc.)
Description
Get-Location gl, pwd cd Display the current directory/present working directory.
Set-Location sl, cd, chdir cd, chdir Change the current directory
Clear-Host cls, clear cls Clear the screen
Copy-Item cpi, copy, cp copy Copy one or several files / a whole directory tree
Get-Help help, man help Help on commands
Remove-Item ri, del, erase, rmdir, rd, rm del, erase, rmdir, rd Delete a file / a directory
Rename-Item rni, ren ren, rename Rename a file / a directory
Move-Item mi, move, mv move Move a file / a directory to a new location
Get-ChildItem gci, dir, ls dir List all files / directories in the (current) directory
Write-Output echo, write echo Print strings, variables etc. to standard output
Pop-Location popd popd
Change the current directory to the directory most recently
pushed onto the stack
Push-Location pushd pushd Push the current directory onto the stack
Set-Variable sv, set set Set the value of a variable / create a variable
 Boolean: True or false condition.
 Byte: An 8-bit unsigned whole number from 0 to 255, such as 32.
 Char: A 16-bit unsigned whole number from 0 to 65,535. For example, 1,026.
 Date: A calendar date, such as January 1, 2009.
 Decimal: A 128-bit decimal value, such as 3.14159265.
 Double: A double-precision 64-bit floating point number. In effect, this is another kind of
decimal value but has a narrower range of values than a decimal.
 Integer: A 32-bit signed whole number from –2,147,483,648 to 2,147,483,647, such as 152 or –
1839.
 Long: A 64-bit signed whole number. This is like an integer but holds far more values, such as
9,233,372,036,854,775,807.
 Object: Any kind of object.
 Short: A 16-bit unsigned whole number. This is like an integer but holds far fewer values. It
can only hold values from –32,768 to 32,767.
 Single: A single-precision 32-bit floating point number. This is like a double but holds far
fewer values, such as 20.3654.
 String: A grouping of characters that most people just call text.
Data types
 $MyVariable
 $AVariableWithANumber6
 ${A variable with spaces}
 ${A variable with special characters @#%%}
Variables
 $Error: An array of error objects representing the most recent errors.
 $Host: Current host application for Windows PowerShell.
 $Profile: Stores the full path to the Windows PowerShell user profile for
the default shell.
 $PID: Contains the process identifier of the Windows PowerShell
process.
 $PSUICulture: Stores the name of the UI culture currently in use.
 $NULL: Contains NULL or empty value.
 $False: Contains FALSE.
 $True: Contains TRUE.
Automatic variables
 Concatenating
 Escape characters
 Multiline string
 String functions
String handling
 Backslash: 
 Dollar sign: $
 Dot: .
 Pipe: |
 Question mark: ?
 Star: *
 Plus sign: +
 Open square bracket: [
 Open parenthesis: (
 Close parenthesis: )
 Caret: ^
Regular expressions
 Create functions
 Calling functions
 Passing arguments
 Return values
Functions
Operator Meaning
-eq Equal
-ne Not equal
-ine Not equal; not case sensitive (new in Windows PowerShell 2)
-lt Less than
-le Less than or equal
-gt Greater than
-ge Greater than or equal
Operators
 if statement
 switch statement
 for loop
 foreach loop
 while loop
 do while loop
 do until loop
Control flow statements
 Add (adds a Timespan value)
 AddDays
 AddHours
 AddMilliseconds
 AddMinutes
 AddMonths
 AddSeconds
 AddTicks
 AddYears
DateTime
 Arrays
 Hash tables
 Access elements
Collections
 Reading files
 Writing file
 Create files
 Delete files
 Copy / Rename / Move files
File handling
 Access system information
 Disk info
 Services
 Event log
 BIOS
Windows Management
Infrastructure (WMI)
 Connect to SQL Server
 Create SQL Command
 Execute and capture data
 Display data
SQL Query Execution
 Count errors
 Throw exception
 Handle exception
 Write to log file
 Write to Event log
Exception handling
 Message box
 Installed drivers info
 Path shrink
 Convert to PDF
 Send email
 Hello Anna
 Text to audio recording
Cool stuff
 Not allowing scripts to execute
 Improperly using commas to separate parameters when
calling a function
 Not defining functions before using them
 Forgetting that pipelines pass objects and not just strings
 Not casting variables as a string
 Making incorrect comparisons
 Expending the pipeline to far
 Not taking variable scope in account
 Debugging without the debugger
 Forgetting to use available .NET classes
Common Mistakes
 Windows PowerShell™ 2 For Dummies® by Steve Seguis
 http://powershell.com/cs/
 http://en.wikipedia.org/wiki/Windows_PowerShell
 http://sandunangelo.blogspot.com/2010/02/introduction-to-
powershell-scripting.html
References
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

Powershell Training
Powershell TrainingPowershell Training
Powershell TrainingFahad Noaman
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePassWill Schroeder
 
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...Edureka!
 
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
 
Linux admin interview questions
Linux admin interview questionsLinux admin interview questions
Linux admin interview questionsKavya Sri
 
Power shell training
Power shell trainingPower shell training
Power shell trainingDavid Brabant
 
Offensive PowerShell Cheat Sheet
Offensive	PowerShell Cheat SheetOffensive	PowerShell Cheat Sheet
Offensive PowerShell Cheat SheetRahmat Nurfauzi
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET CoreAvanade Nederland
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak Abhishek Koserwal
 
Workshop spring session 2 - La persistance au sein des applications Java
Workshop spring   session 2 - La persistance au sein des applications JavaWorkshop spring   session 2 - La persistance au sein des applications Java
Workshop spring session 2 - La persistance au sein des applications JavaAntoine Rey
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basicsManav Prasad
 
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 
OAuth2 and Spring Security
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring SecurityOrest Ivasiv
 
Linux command ppt
Linux command pptLinux command ppt
Linux command pptkalyanineve
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentalsRaghu nath
 

Was ist angesagt? (20)

Powershell Training
Powershell TrainingPowershell Training
Powershell Training
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePass
 
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
 
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...
 
Linux admin interview questions
Linux admin interview questionsLinux admin interview questions
Linux admin interview questions
 
Power shell training
Power shell trainingPower shell training
Power shell training
 
Offensive PowerShell Cheat Sheet
Offensive	PowerShell Cheat SheetOffensive	PowerShell Cheat Sheet
Offensive PowerShell Cheat Sheet
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
 
spring-api-rest.pdf
spring-api-rest.pdfspring-api-rest.pdf
spring-api-rest.pdf
 
Workshop spring session 2 - La persistance au sein des applications Java
Workshop spring   session 2 - La persistance au sein des applications JavaWorkshop spring   session 2 - La persistance au sein des applications Java
Workshop spring session 2 - La persistance au sein des applications Java
 
Apache ppt
Apache pptApache ppt
Apache ppt
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basics
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
LDAP
LDAPLDAP
LDAP
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
OAuth2 and Spring Security
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring Security
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
 

Ähnlich wie Windows PowerShell

Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architectureAjeet Singh
 
A Scalable I/O Manager for GHC
A Scalable I/O Manager for GHCA Scalable I/O Manager for GHC
A Scalable I/O Manager for GHCJohan Tibell
 
quickguide-einnovator-9-redis
quickguide-einnovator-9-redisquickguide-einnovator-9-redis
quickguide-einnovator-9-redisjorgesimao71
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdfhamzadamani7
 
Addressing Scenario
Addressing ScenarioAddressing Scenario
Addressing ScenarioTara Hardin
 
Processes And Job Control
Processes And Job ControlProcesses And Job Control
Processes And Job Controlahmad bassiouny
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLJerry Yang
 
Tech Days09 Sqldev
Tech Days09 SqldevTech Days09 Sqldev
Tech Days09 Sqldevllangit
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developersllangit
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developersllangit
 
"Optimization of a .NET application- is it simple ! / ?", Yevhen Tatarynov
"Optimization of a .NET application- is it simple ! / ?",  Yevhen Tatarynov"Optimization of a .NET application- is it simple ! / ?",  Yevhen Tatarynov
"Optimization of a .NET application- is it simple ! / ?", Yevhen TatarynovFwdays
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core ModuleKatie Gulley
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubEssam Salah
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesKeshav Murthy
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1MariaDB plc
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1MariaDB plc
 
Oracle Wait Events That Everyone Should Know.ppt
Oracle Wait Events That Everyone Should Know.pptOracle Wait Events That Everyone Should Know.ppt
Oracle Wait Events That Everyone Should Know.pptTricantinoLopezPerez
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell ScriptingJaibeer Malik
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 

Ähnlich wie Windows PowerShell (20)

Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
A Scalable I/O Manager for GHC
A Scalable I/O Manager for GHCA Scalable I/O Manager for GHC
A Scalable I/O Manager for GHC
 
quickguide-einnovator-9-redis
quickguide-einnovator-9-redisquickguide-einnovator-9-redis
quickguide-einnovator-9-redis
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
 
Addressing Scenario
Addressing ScenarioAddressing Scenario
Addressing Scenario
 
Processes And Job Control
Processes And Job ControlProcesses And Job Control
Processes And Job Control
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
 
Tech Days09 Sqldev
Tech Days09 SqldevTech Days09 Sqldev
Tech Days09 Sqldev
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developers
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developers
 
"Optimization of a .NET application- is it simple ! / ?", Yevhen Tatarynov
"Optimization of a .NET application- is it simple ! / ?",  Yevhen Tatarynov"Optimization of a .NET application- is it simple ! / ?",  Yevhen Tatarynov
"Optimization of a .NET application- is it simple ! / ?", Yevhen Tatarynov
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core Module
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge Club
 
AD Cmdlets
AD CmdletsAD Cmdlets
AD Cmdlets
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
Oracle Wait Events That Everyone Should Know.ppt
Oracle Wait Events That Everyone Should Know.pptOracle Wait Events That Everyone Should Know.ppt
Oracle Wait Events That Everyone Should Know.ppt
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 

Mehr von Sandun Perera

Azure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptxAzure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptxSandun Perera
 
Bootstrap 5 whats new
Bootstrap 5   whats newBootstrap 5   whats new
Bootstrap 5 whats newSandun Perera
 
Angular Form Validations
Angular Form ValidationsAngular Form Validations
Angular Form ValidationsSandun Perera
 
Introduction to NuoDB
Introduction to NuoDBIntroduction to NuoDB
Introduction to NuoDBSandun Perera
 
Microsoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 CustomizationMicrosoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 CustomizationSandun Perera
 
Tale of the photo camera
Tale of the photo cameraTale of the photo camera
Tale of the photo cameraSandun Perera
 
Visual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and TricksVisual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and TricksSandun Perera
 
What’s new in Visual Studio 2010
What’s new in Visual Studio 2010What’s new in Visual Studio 2010
What’s new in Visual Studio 2010Sandun Perera
 

Mehr von Sandun Perera (12)

Azure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptxAzure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptx
 
iUpgradable
iUpgradableiUpgradable
iUpgradable
 
Bootstrap 5 whats new
Bootstrap 5   whats newBootstrap 5   whats new
Bootstrap 5 whats new
 
Blazor
BlazorBlazor
Blazor
 
Angular Form Validations
Angular Form ValidationsAngular Form Validations
Angular Form Validations
 
Introduction to NuoDB
Introduction to NuoDBIntroduction to NuoDB
Introduction to NuoDB
 
Microsoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 CustomizationMicrosoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 Customization
 
SQL Windowing
SQL WindowingSQL Windowing
SQL Windowing
 
Car care
Car careCar care
Car care
 
Tale of the photo camera
Tale of the photo cameraTale of the photo camera
Tale of the photo camera
 
Visual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and TricksVisual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and Tricks
 
What’s new in Visual Studio 2010
What’s new in Visual Studio 2010What’s new in Visual Studio 2010
What’s new in Visual Studio 2010
 

Kürzlich hochgeladen

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Kürzlich hochgeladen (20)

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

Windows PowerShell

  • 1. Windows PowerShell Sandun Perera Geveo Australasia 30th May 2012
  • 2.  Command line interpreter  Unix shell  Apple script  MS-DOS  Windows Script Host  Windows PowerShell  Administrative tasks  Routine tasks  Maintenance tasks Shell scripting
  • 3.  1. Install Microsoft .NET Framework 2.0  2. Install Microsoft .NET Framework 3.5.1.  Required for Windows PowerShell Integrated Scripting Environment (ISE) and Out-GridView.  3. Install WinRM 2.0 CTP3. (Windows Remote Shell)  This is required if you want to take advantage of the remoting and back- ground jobs features.  4. Install Windows PowerShell 2. Starting point (ps2)
  • 5.  Set Execution Policy  Customise Console  Profile editing  Profile using Permission and Profiling
  • 6. Cmdlets Windows PowerShell (Cmdlet) Windows PowerShell (Alias) cmd.exe / COMMAND.COM (MS-DOS, Windows, OS/2, etc.) Description Get-Location gl, pwd cd Display the current directory/present working directory. Set-Location sl, cd, chdir cd, chdir Change the current directory Clear-Host cls, clear cls Clear the screen Copy-Item cpi, copy, cp copy Copy one or several files / a whole directory tree Get-Help help, man help Help on commands Remove-Item ri, del, erase, rmdir, rd, rm del, erase, rmdir, rd Delete a file / a directory Rename-Item rni, ren ren, rename Rename a file / a directory Move-Item mi, move, mv move Move a file / a directory to a new location Get-ChildItem gci, dir, ls dir List all files / directories in the (current) directory Write-Output echo, write echo Print strings, variables etc. to standard output Pop-Location popd popd Change the current directory to the directory most recently pushed onto the stack Push-Location pushd pushd Push the current directory onto the stack Set-Variable sv, set set Set the value of a variable / create a variable
  • 7.  Boolean: True or false condition.  Byte: An 8-bit unsigned whole number from 0 to 255, such as 32.  Char: A 16-bit unsigned whole number from 0 to 65,535. For example, 1,026.  Date: A calendar date, such as January 1, 2009.  Decimal: A 128-bit decimal value, such as 3.14159265.  Double: A double-precision 64-bit floating point number. In effect, this is another kind of decimal value but has a narrower range of values than a decimal.  Integer: A 32-bit signed whole number from –2,147,483,648 to 2,147,483,647, such as 152 or – 1839.  Long: A 64-bit signed whole number. This is like an integer but holds far more values, such as 9,233,372,036,854,775,807.  Object: Any kind of object.  Short: A 16-bit unsigned whole number. This is like an integer but holds far fewer values. It can only hold values from –32,768 to 32,767.  Single: A single-precision 32-bit floating point number. This is like a double but holds far fewer values, such as 20.3654.  String: A grouping of characters that most people just call text. Data types
  • 8.  $MyVariable  $AVariableWithANumber6  ${A variable with spaces}  ${A variable with special characters @#%%} Variables
  • 9.  $Error: An array of error objects representing the most recent errors.  $Host: Current host application for Windows PowerShell.  $Profile: Stores the full path to the Windows PowerShell user profile for the default shell.  $PID: Contains the process identifier of the Windows PowerShell process.  $PSUICulture: Stores the name of the UI culture currently in use.  $NULL: Contains NULL or empty value.  $False: Contains FALSE.  $True: Contains TRUE. Automatic variables
  • 10.  Concatenating  Escape characters  Multiline string  String functions String handling
  • 11.  Backslash:  Dollar sign: $  Dot: .  Pipe: |  Question mark: ?  Star: *  Plus sign: +  Open square bracket: [  Open parenthesis: (  Close parenthesis: )  Caret: ^ Regular expressions
  • 12.  Create functions  Calling functions  Passing arguments  Return values Functions
  • 13. Operator Meaning -eq Equal -ne Not equal -ine Not equal; not case sensitive (new in Windows PowerShell 2) -lt Less than -le Less than or equal -gt Greater than -ge Greater than or equal Operators
  • 14.  if statement  switch statement  for loop  foreach loop  while loop  do while loop  do until loop Control flow statements
  • 15.  Add (adds a Timespan value)  AddDays  AddHours  AddMilliseconds  AddMinutes  AddMonths  AddSeconds  AddTicks  AddYears DateTime
  • 16.  Arrays  Hash tables  Access elements Collections
  • 17.  Reading files  Writing file  Create files  Delete files  Copy / Rename / Move files File handling
  • 18.  Access system information  Disk info  Services  Event log  BIOS Windows Management Infrastructure (WMI)
  • 19.  Connect to SQL Server  Create SQL Command  Execute and capture data  Display data SQL Query Execution
  • 20.  Count errors  Throw exception  Handle exception  Write to log file  Write to Event log Exception handling
  • 21.  Message box  Installed drivers info  Path shrink  Convert to PDF  Send email  Hello Anna  Text to audio recording Cool stuff
  • 22.  Not allowing scripts to execute  Improperly using commas to separate parameters when calling a function  Not defining functions before using them  Forgetting that pipelines pass objects and not just strings  Not casting variables as a string  Making incorrect comparisons  Expending the pipeline to far  Not taking variable scope in account  Debugging without the debugger  Forgetting to use available .NET classes Common Mistakes
  • 23.  Windows PowerShell™ 2 For Dummies® by Steve Seguis  http://powershell.com/cs/  http://en.wikipedia.org/wiki/Windows_PowerShell  http://sandunangelo.blogspot.com/2010/02/introduction-to- powershell-scripting.html References

Hinweis der Redaktion

  1. Script pane Output pane Command pane