Your SlideShare is downloading. ×
0
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
The Power of PowerShell: Advanced
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

The Power of PowerShell: Advanced

713

Published on

More info on http://techdays.be.

More info on http://techdays.be.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
713
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
62
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
  • Check out about_Regular_Expressions
  • Transcript

    • 1. The Power Of PowerShell: Advanced Kurt Roggen, Technical Consultant, Devoteamkurt.roggen@devoteam.be
    • 2. Agenda • PowerShell Basics • PS Syntax • Pipeline • 3 cmdlets to know/remember • PowerShell Advanced • Functions • Modules • Comment Based Help • Accepting PS Objects from the pipeline • Creating PS Objects
    • 3. PS Cmdlet Syntax verb-<ID>SingularNoun Get-Service, New-Mailbox, Get-ADUser, Get-Disk, Get-VM, Start-Process, Stop-Process, New-NALun, Get-AzureVM, ...
    • 4. 3 cmdlets to know/remember!!PowerShell is self-discoverable using1. Get-Command2. Get-Help3. Get-Member
    • 5. 1. Get-Help Displays help information Get-Help Get-Help get-service Get-Help get-service -examples Get-Help get-service -detailed Get-Help get-service -full Get-Help get-service -online Get-Help get-service -parameter ComputerName Get-Help * -parameter ComputerName Get-Help about_wildcards Alias: help
    • 6. 2. Get-CommandDisplays all commands (cmdlet, function, alias)Get-CommandGet-Command -verb getGet-Command -noun serviceGet-Command -module ActiveDirectoryGet-Command -CmdType cmdletAlias: gcm
    • 7. 3. Get-MemberDisplays all MemberTypes (Property,Methods,...)Get-Service | Get-MemberGet-Member –InputType (Get-Service)Get-Member –MemberType MethodGet-Member –MemberType PropertyAlias: gm
    • 8. Modules
    • 9. ModulesCollections of cmdletsPortableStored in file system %windir%System32WindowsPoweshell1.0ModulesModule Cmdlets: New-Module, Get-Module, Import-Module, Remove-ModuleModule Manifest Cmdlets: New-ModuleManifest , Test-ModuleManifest
    • 10. Functions
    • 11. Creating Functions function Get-OS{ param( [string[]]$ComputerName = $env:COMPUTERNAME ) gwmi Win32_OperatingSystem -ComputerName $ComputerName} PS C:> Get-OS -ComputerName “MyClient1”, ”MyClient2”
    • 12. Creating ModulesModules Location:%windir%System32WindowsPoweshell1.0ModulesCreate a PS module folder (eg: MyModule)Save PS module with extension .PSM1 instead of .PS1 (MyModule.psm1) • PS module folder name must have same name as PS module file basename
    • 13. Comment Based Help
    • 14. Comment Based Help Function Get-OS { <# .SYNOPSIS <toktok> .DESCRIPTION <toktok> .PARAMETER ComputerName <toktok> .EXAMPLE Get-OS .LINK http://mysite.com/get-os/ #> Param ( [string]$ComputerName, [switch]$Details ) }
    • 15. Accepting Pipeline Input
    • 16. Accepting Pipeline Input function Get-OS { param( [Parameter(ValueFromPipeLine=$true)] [string[]]$ComputerName = $env:COMPUTERNAME ) PROCESS { <blabla> } }
    • 17. Creating PS Objects
    • 18. Create PS Object$Obj = New-Object –Type PSObject$Obj | Add-Member –Name ComputerName –Value $ComputerName –Type NoteProperty$Obj | Add-Member –Name OS –Value $OS –Type NoteProperty$Obj | Add-Member –Name ServicePack –Value $ServicePack –Type NoteProperty$Obj | Add-Member –Name Version –Value $ComputerName –Type NotePropertyReturn PS Object (to pipeline)$Obj
    • 19. ConclusionPowerShell is the future presentPowerShell is Self-discoverable Remember 3 basic commandsReuse code using functions in modulesIt’s easy - Try it, you’ll see!

    ×