0% found this document useful (0 votes)
72 views3 pages

Commandes Powershell

This document contains examples of PowerShell commands for getting processes, members, dates, aliases, help, and more. It demonstrates how to get processes sorted by handle count, set the execution policy, get members of different object types, format dates, get commands by verb and noun, get help in different formats, set aliases, and view profile files. It also shows basic data type casting and conversions between numbers, strings, and characters.

Uploaded by

Marc Bensoussan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views3 pages

Commandes Powershell

This document contains examples of PowerShell commands for getting processes, members, dates, aliases, help, and more. It demonstrates how to get processes sorted by handle count, set the execution policy, get members of different object types, format dates, get commands by verb and noun, get help in different formats, set aliases, and view profile files. It also shows basic data type casting and conversions between numbers, strings, and characters.

Uploaded by

Marc Bensoussan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

COMMANDES

Get-Process
Get-Process | Sort-Object Handles
Get-Process | Sort-Object Handles -Descending
Get-Process | Sort-Object Handles -Descending | Select-Object -First 10
Get-Process | Sort-Object Handles -Descending | Select-Object -First 10 | Group-Object
Company

Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned

Get-Process
Get-Process | Get-Member
Get-Process | Get-Member | more
Get-Process | Get-Member -MemberType Property | more
Get-Process | Get-Member -MemberType Properties | more
Get-Process | Get-Member -MemberType Method | more

Get-Date
Get-Date | Get-Member
(Get-Date).Month
(Get-Date).Day
(Get-Date).Ticks

Get-Command
Get-Command -Verb Get
Get-Command -Noun Variable
Get-Command *Object

Get-Process
Get-Process -id 0,4
Get-Process –name lsass,smss
Get-Help Get-Process
Get-Help Get-Process –detailed
Get-Help Get-Process –full
Get-Help Get-Process –examples
Get-Help about_*

Set-Alias files Get-ChildItem


Set-Alias ed C:\Windows\System32\Notepad.exe
Get-Command -Noun Alias
Get-Help about_Alias | more
# Note that the aliases defined earlier won't be available outside of the script.
Set-Alias files Get-ChildItem -Scope Global
Set-Alias ed C:\Windows\System32\Notepad.exe -Scope Global

Notepad $PSHOME\Examples\profile.ps1
Notepad $HOME\Documents\WindowsPowerShell\profile.ps1
# course 6434A Module 2 Demo 7
[int] $x = 6.626068e-34 # use of [int] here rounds the value to zero.
[double] $h = 6.626068e-34 # Planck's constant
$k = [double] 1.3806504e-23 # Boltzmann's constant
[char] 33 # exclamation
[char] 42 # asterisk
[char] 960 # pi
$fun = "string" # string literal
$numstring = [string] 42 # number as string
$numstring.length
$numstring
$aster = [string] [char] 42 # character in string
$aster.length
$aster

course 6434A Module 2 Demo 8


Get-Command -Verb Get
Get-Acl permissions
Get-Alias
Get-AuthenticodeSignature $PSHOME\Examples\profile.ps1
Get-ChildItem
Get-Command | Measure-Object
Get-Content $env:SystemRoot\system32\drivers\etc\services
Get-Credential
Get-Culture Langue régionale
Get-Date
Get-EventLog System -newest 20
Get-ExecutionPolicy
Get-Help
Get-History
Get-Host
Get-Item $env:SystemRoot\system32\ntoskrnl.exe
Get-ItemProperty HKLM:\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
Get-Location
Get-Date | Get-Member
# Use password of "secret" (no quotes) for Get-PfxCertificate
Get-PfxCertificate empty.pfx
Get-Process
Get-PSDrive
Get-PSProvider
Get-PSSnapin
Get-Service
Get-TraceSource
Get-UICulture | Format-List
Get-Process | Sort-Object | Get-Unique
Get-Variable
Get-WmiObject Win32_UserAccount
PS C:\Documents and Settings\Administrateur> get-alias rm

CommandType Name Definition


----------- ---- ----------
Alias rm Remove-Item

PS C:\Documents and Settings\Administrateur> get-alias del

CommandType Name Definition


----------- ---- ----------
Alias del Remove-Item

You might also like