Skip to content

Instantly share code, notes, and snippets.

@killshot13
Last active December 14, 2022 02:19
Show Gist options
  • Save killshot13/e1f61f452b4e1d900550e7e7b9bd3c63 to your computer and use it in GitHub Desktop.
Save killshot13/e1f61f452b4e1d900550e7e7b9bd3c63 to your computer and use it in GitHub Desktop.
PowerShell Snippets

PowerShell Snippets

A quick reference to copypasta useful PowerShell commands. (randomCollection)

one-liners


1.) Identify & Kill a Process Listening on a Given Port (assuming PORT 5000 and PID 348):

> netstat -ano | findstr :5000
> TASKKILL /PID 348 /F

2.) Get CPU Cores and Processor Information

> Get-WmiObject -Class Win32_Processor | Select-Object -Property Name, Number*

3.) Get List of Connected Physical Drives

> wmic diskdrive list brief

4.) Force Delete a Protected Folder w/o Confirmation [cmd.exe]

> rmdir /Q /S dir_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment