Files
Powershell-Training/5.System_Management/PowerShell System Management.md
2026-01-10 01:20:47 +01:00

2.5 KiB

PowerShell System Management

Get-ComputerInfo

For having information about the system

Get-ComputerInfo

$serverInfo = Get-ComputerInfo
$serverInfo.OsVersion
Get-ComputerInfo | Seleect-Object -Property 'Timezone'

Processes

Windows processes are running instances of programs that contain their own memory space and system resources. Each process can host one or more threads and is managed by the operating system to provide isolation, scheduling, and controlled access to system resources.

Get-Process

For having all the process

Get-Process

#find one by name
Get-Process -Name taskmngr

Get-Process | Format-Table -Property Name, Id

Start-Process

start a process

Start-Process -FilePath "C:\Windows\system32\notepad.exe"

Stop-Process

Stop-Process -Name "notepad"

Stop-Process -Name "notepad" -Force

Service

Windows services are background programs that run independently of user logins and provide core system or application functionality. They are managed by the Service Control Manager and can be started, stopped, paused, or configured to run automatically, making them essential for system stability, networking, security, and ongoing operations.

Get-Service

For listing every services

Get-Service -Name "Print Spooler"

Get-Service | Format-Table -Property Statys, DisplayName

Get-Service | Where-Object {$_.Status -eq "Stopped"}
Get-Service | Where-Object {$_.Status -eq "Running"}

Stop-Service

Stop-Service -Name "Print Spooler"

Start-Service

Start-Service -Name "Print Spooler"

Restart-Service

Restart-Service -Name "Print Spooler"

Volumes

Windows volumes are logical storage units used to organize and access data on physical disks. They are formatted with a file system, assigned a drive letter or mount point, and managed by the operating system to provide structured, persistent storage for files and applications.

Get-Volume

Get-Volume

Get-Volume -DriveLetter C | Format-List

$CDrive = Get-Volume -DriveLetter C 

#To format Size Remaining output to GB
$CDrive.SizeRemaining/1GB

Recycle Bin

The Windows Recycle Bin is a special system folder that temporarily stores deleted files and folders. It allows users to restore items if they were removed accidentally, acting as a safety mechanism before permanent deletion.

Clear-RecycleBin

Clear-RecycleBin

Clear-RecycleBin -Drive C -Force