PowerShell Commands for daily use

I’ve just collected some simple but powerful commands here.

List all Processes by their Processor time:

Get-Process | Sort-Object cpu -descending | Select-Object -first 10 | Format-Table name, CPU -auto

List Environment Variables, in cmd.exe “echo %username%” is in Powershell:

Get-Content env:username Write-Host $env:username

Kill a running process like calc.exe instead uf using TaskManager. Trick here is that there’s already a system predefined alias for Get-Process (alias “ps”) and Stop-Process (alias “kill).

ps calc | kill

Generate random Passwords:

Add-Type -Assembly System.Web

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s