meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| windows:powershell:start [2026/06/11 15:44] – created titannet | windows:powershell:start [2026/06/15 13:51] (current) – titannet | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | < | + | < |
| get-Help -name get-help | get-Help -name get-help | ||
| get-command | get-command | ||
| Line 10: | Line 10: | ||
| Get-Command -module ActiveDirectory | Get-Command -module ActiveDirectory | ||
| </ | </ | ||
| + | |||
| + | |||
| + | <code powershell> | ||
| + | Get-Service " | ||
| + | |||
| + | Stop-Process -Name notepad -Force | ||
| + | Get-Process | Select-Object Name,ID,CPU | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Enable rdp ===== | ||
| + | |||
| + | |||
| + | < | ||
| + | # Warning | ||
| + | Clear-Host | ||
| + | Write-Output "Run this script on the computer you want to access via RDP" | ||
| + | Write-Output "" | ||
| + | |||
| + | # Ask | ||
| + | Write-Output " | ||
| + | Write-Output " | ||
| + | Write-Output "" | ||
| + | $RemoteAddress = Read-Host " | ||
| + | Write-Output "" | ||
| + | |||
| + | # Registry | ||
| + | Set-ItemProperty -Path " | ||
| + | Set-ItemProperty -Path " | ||
| + | Set-ItemProperty -Path " | ||
| + | |||
| + | # Firewall | ||
| + | New-NetFirewallRule -DisplayName "RDP (TCP)" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3389 -RemoteAddress $RemoteAddress -Profile Any -Enabled True | Out-Null | ||
| + | New-NetFirewallRule -DisplayName "RDP (UDP)" -Direction Inbound -Action Allow -Protocol UDP -LocalPort 3389 -RemoteAddress $RemoteAddress -Profile Any -Enabled True | Out-Null | ||
| + | |||
| + | # Result | ||
| + | Write-Output "Done! Now restart the computer" | ||
| + | Write-Output "" | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Event Logs ===== | ||
| + | |||
| + | <code powershell> | ||
| + | Get-EventLog -LogName Application -Newest 50 | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== Export data ===== | ||
| + | |||
| + | <code powershell> | ||
| + | Get-Process | Export-Csv -Path processes.csv | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Sorting & Filtering ===== | ||
| + | |||
| + | <code powershell> | ||
| + | Get-Process | Sort-Object -Property CPU | ||
| + | Get-Process | Where-Object { $_.CPU -gt 10 } | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||