Powershell commands
Tab completion for powershell
Set-PSReadlineKeyHandler -Key Tab -Function CompleteSearch History
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward#Get the list of log types
Get-EventLog -List
# Get logs which contains text vector
Get-EventLog "Application" | where Message -Like "*vector*"
#Get security type logs
Get-EventLog "Security" | where Message -Like "*vector*"
Shortcuts
Get-Help [help]
Get-Command [gcm]
Get-Command *-service*
Invoke-Command [icm]
Invoke-Command -ScriptBlock {Get-EventLog system -Newest 50}
Invoke-Expression [iex]
Invoke-Expression $Command
Invoke-WebRequest [iwr]
WebRequest -Uri "https://docs.microsoft.com").Links.Href
Set-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy Restricted
Get-Item [gi]
Get-Item M*
Copy-Item [copy]
Copy-Item "C:\Services.htm" -Destination "C:\MyData\MyServices.txt"
Remove-Item [del]
Remove-Item "C:\MyData\MyServices.txt"
Get-Content [cat]
Get-Content "C:\Services.htm" -TotalCount 50
Set-Content [sc]
Get-Content "C:\Services.htm" -TotalCount 50 | Set-Content "Sample.txt"
Get-Variable [gv]
Get-Variable -Name "desc"
Set-Variable [set]
Set-Variable -Name "desc" -Value "A Description"
Get-Process [gps]
Get-Process *explore*
Start-Process [saps]
Start-Process -FilePath "notepad" -Verb runAs
Stop-Process [kill]
Stop-Process -Name "notepad"
Get-Service [gsv]
Get-Service | Where-Object {$_.Status -eq "Running"}
Start-Service [sasv]
Start-Service -Name "WSearch"
Stop-Service [spsv]
Stop-Service -Name "WSearch"
ConvertTo-HTML
Get-Service | ConvertTo-HTML -Property Name, Status > C:\Services.htm
Last updated
Was this helpful?