De Linuxmemo.
[modifier] lister les methodes et propriétés
$variable | Get-Member
$variable | Get-Member -MemberType Method
$variable | Get-Member -MemberType Properties
[modifier] appel des methodes et propriétés
$variable.ToUpper() # methode
$variable.Length # propriété
Select-Object -Property <objet>
-First 5 # pour les collections d'objets
Select-Object Name
Select-Object Name,ID
Select-Object -Index 5
Get-Service | Group-Object -Property status
Sort-Object # sort
Measure-Object # wc
Compare-Object # diff
Get-Service | Where-Object {$_.Status -EQ 'running'} # | Format-Table -AutoSize
| Select-String <string> # grep
| Format-List
| Format-List -Property Name,Length
| Format-List *
| Format-Table
| Format-Table -Property Name,Length
| Format-Table -AutoSize
| Out-GridView
$Nb = [System.Convert]::ToString(1234,8)
Get-WmiObject -List | Select-Object -Property Name |Format-Table -AutoSize
Get-WmiObject -List | Select-Object -Property Name | Select-String ComputerSystem
Get-WmiObject -Class Win32_ComputerSystem
[modifier] modules et snap-in (dll)
Get-PSSnapin
Get-Module
Get-Module -ListAvailable
Import-Module -Name NetTCPIP # plus utilisé depuis Powershell 3, car automatique
Get-Command -Module NetTCPIP