209 lines
2.9 KiB
Markdown
209 lines
2.9 KiB
Markdown
|
|
# PowerShell Commands for Support / SME / Helpdesk
|
||
|
|
|
||
|
|
Practical commands for **Support Engineers and SMEs** managing user
|
||
|
|
issues, workstations, and basic troubleshooting.
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# Table of Contents
|
||
|
|
|
||
|
|
1. Computer Information
|
||
|
|
2. Network Troubleshooting
|
||
|
|
3. Process and Application Issues
|
||
|
|
4. Service Troubleshooting
|
||
|
|
5. File Management
|
||
|
|
6. Event Logs
|
||
|
|
7. Remote Computer Access
|
||
|
|
8. Useful Support Commands
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 1. Computer Information
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-ComputerInfo
|
||
|
|
hostname
|
||
|
|
whoami
|
||
|
|
```
|
||
|
|
|
||
|
|
Check uptime:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
(Get-CimInstance Win32_OperatingSystem).LastBootUpTime
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 2. Network Troubleshooting
|
||
|
|
|
||
|
|
Check IP:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-NetIPAddress
|
||
|
|
ipconfig
|
||
|
|
```
|
||
|
|
|
||
|
|
Ping test:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Test-Connection google.com
|
||
|
|
```
|
||
|
|
|
||
|
|
Check if port open:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Test-NetConnection server01 -Port 443
|
||
|
|
```
|
||
|
|
|
||
|
|
DNS lookup:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Resolve-DnsName google.com
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 3. Process and Application Issues
|
||
|
|
|
||
|
|
List processes:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-Process
|
||
|
|
```
|
||
|
|
|
||
|
|
Find application:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-Process chrome
|
||
|
|
```
|
||
|
|
|
||
|
|
Kill frozen app:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Stop-Process -Name chrome -Force
|
||
|
|
```
|
||
|
|
|
||
|
|
Start application:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Start-Process notepad
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 4. Service Troubleshooting
|
||
|
|
|
||
|
|
Check services:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-Service
|
||
|
|
```
|
||
|
|
|
||
|
|
Restart a service:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Restart-Service spooler
|
||
|
|
```
|
||
|
|
|
||
|
|
Check if running:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-Service spooler
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 5. File Management
|
||
|
|
|
||
|
|
List files:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-ChildItem
|
||
|
|
```
|
||
|
|
|
||
|
|
Copy files:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Copy-Item file.txt C:\Temp
|
||
|
|
```
|
||
|
|
|
||
|
|
Delete file:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Remove-Item file.txt
|
||
|
|
```
|
||
|
|
|
||
|
|
Read log file:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-Content log.txt -Tail 50
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 6. Event Logs
|
||
|
|
|
||
|
|
Recent system errors:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-WinEvent -LogName System -MaxEvents 20
|
||
|
|
```
|
||
|
|
|
||
|
|
Application errors:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-WinEvent -LogName Application -MaxEvents 20
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 7. Remote Computer Access
|
||
|
|
|
||
|
|
Connect remote PowerShell:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Enter-PSSession PC01
|
||
|
|
```
|
||
|
|
|
||
|
|
Run command remotely:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Invoke-Command -ComputerName PC01 -ScriptBlock { Get-Service }
|
||
|
|
```
|
||
|
|
|
||
|
|
Restart remote computer:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Restart-Computer PC01
|
||
|
|
```
|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# 8. Useful Support Commands
|
||
|
|
|
||
|
|
Check disk space:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-Volume
|
||
|
|
```
|
||
|
|
|
||
|
|
List logged in users:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
quser
|
||
|
|
```
|
||
|
|
|
||
|
|
Find large files:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-ChildItem C:\ -Recurse |
|
||
|
|
Sort Length -Descending |
|
||
|
|
Select -First 10
|
||
|
|
```
|
||
|
|
|
||
|
|
Check installed updates:
|
||
|
|
|
||
|
|
``` powershell
|
||
|
|
Get-HotFix
|
||
|
|
```
|