Windows/PowerShell/Common Tools

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "Below are some common tools for Powershell 7 Core with a focus on system administration. =Show open ports= <nowiki>PS /> Get-NetTCPConnection PS /> Get-NetTCPConnection | Whe...")
 
 
Line 6: Line 6:
 
  <nowiki>PS /> Get-Process
 
  <nowiki>PS /> Get-Process
 
PS /> Get-Process | Sort-Object CPU -Descending | Format-Table -Property Name, CPU, Id, MemoryUsage -AutoSize
 
PS /> Get-Process | Sort-Object CPU -Descending | Format-Table -Property Name, CPU, Id, MemoryUsage -AutoSize
 +
PS /> while ($true) { Get-Process | Sort-Object CPU -Descending | Format-Table -Property Name, CPU, Id, MemoryUsage -AutoSize; Start-Sleep -Seconds 1 }</nowiki>
 +
=Disk Space=
 +
<nowiki>PS /> Get-PSDrive -PSProvider FileSystem
 +
PS /> Get-Volume</nowiki>
 +
=CPU Usage=
 +
<nowiki>PS /> Get-Counter -Counter "\Processor(_Total)\% Processor Time"
 +
PS /> Get-Counter -Counter "\Processor(_Total)\% Processor Time" -Continuous</nowiki>
 +
=Network Utilization=
 +
<nowiki>PS /> Get-NetAdapterStatistics
 +
PS /> Get-Counter -Counter "\Network Interface(*)\Bytes Total/sec"
 +
PS /> Get-Counter -Counter "\Network Interface(*)\Bytes Total/sec" -Continuous</nowiki>
 +
=Uptime=
 +
<nowiki>PS /> $uptime = (Get-Date) - (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime
 +
PS />$uptime</nowiki>
 +
=Memory Usage=
 +
<nowiki>PS /> Get-PhysicalMemory
 +
PS /> Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object TotalVisibleMemorySize, FreePhysicalMemory</nowiki>
 +
=List Installed Software=
 +
<nowiki>PS /> Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version
 +
PS /> Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion</nowiki>
 +
=Check System Updates=
 +
<nowiki>PS /> Install-Module -Name PSWindowsUpdate -Force -SkipPublisherCheck
 +
PS /> Get-WindowsUpdate</nowiki>
 +
=Get System Info=
 +
<nowiki>PS /> Get-ComputerInfo
 +
PS /> (Get-ComputerInfo).OsArchitecture</nowiki>
 +
=Check Active Users Sessions=
 +
<nowiki>PS /> quser</nowiki>
 +
=Show Event Logs=
 +
<nowiki>PS /> Get-EventLog -LogName System -Newest 10</nowiki>
 +
=List Scheduled Tasks=
 +
<nowiki>PS /> Get-ScheduledTask</nowiki>

Latest revision as of 20:31, 23 November 2024

Below are some common tools for Powershell 7 Core with a focus on system administration.

Contents

[edit] Show open ports

PS /> Get-NetTCPConnection
PS /> Get-NetTCPConnection | Where-Object { $_.State -eq 'Listen' }

[edit] Process List

PS /> Get-Process
PS /> Get-Process | Sort-Object CPU -Descending | Format-Table -Property Name, CPU, Id, MemoryUsage -AutoSize
PS /> while ($true) { Get-Process | Sort-Object CPU -Descending | Format-Table -Property Name, CPU, Id, MemoryUsage -AutoSize; Start-Sleep -Seconds 1 }

[edit] Disk Space

PS /> Get-PSDrive -PSProvider FileSystem
PS /> Get-Volume

[edit] CPU Usage

PS /> Get-Counter -Counter "\Processor(_Total)\% Processor Time"
PS /> Get-Counter -Counter "\Processor(_Total)\% Processor Time" -Continuous

[edit] Network Utilization

PS /> Get-NetAdapterStatistics
PS /> Get-Counter -Counter "\Network Interface(*)\Bytes Total/sec"
PS /> Get-Counter -Counter "\Network Interface(*)\Bytes Total/sec" -Continuous

[edit] Uptime

PS /> $uptime = (Get-Date) - (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime
PS />$uptime

[edit] Memory Usage

PS /> Get-PhysicalMemory
PS /> Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object TotalVisibleMemorySize, FreePhysicalMemory

[edit] List Installed Software

PS /> Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version
PS /> Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion

[edit] Check System Updates

PS /> Install-Module -Name PSWindowsUpdate -Force -SkipPublisherCheck
PS /> Get-WindowsUpdate

[edit] Get System Info

PS /> Get-ComputerInfo
PS /> (Get-ComputerInfo).OsArchitecture

[edit] Check Active Users Sessions

PS /> quser

[edit] Show Event Logs

PS /> Get-EventLog -LogName System -Newest 10

[edit] List Scheduled Tasks

PS /> Get-ScheduledTask
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
MagicMirror
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
Politics
Volkswagen
Covid
NCDMV
Toolbox