Your SlideShare is downloading. ×
0
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Introduction To Power Shell
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduction To Power Shell

1,615

Published on

This is a presentation for my "Introduction to PowerShell" workshop

This is a presentation for my "Introduction to PowerShell" workshop

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,615
On Slideshare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
63
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×