meta data for this page
Powershell
get-Help -name get-help get-command get-command -name get-* Get-command -name Get-p* Get-Module Get-Command -module ActiveDirectory
Get-Service "vm*" | Get-Member 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 "Remote address can be an IP address or network with CIDR" Write-Output "Example: 192.168.0.5 or 192.168.0.0/24" Write-Output "" $RemoteAddress = Read-Host "Remote Address" Write-Output "" # Registry Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server"-Name "fDenyTSConnections" -Value 0 Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows NT\Terminal Services\Client" -Name "fClientDisableUDP" -Value 0 Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Value 1 # 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
Get-EventLog -LogName Application -Newest 50
Export data
Get-Process | Export-Csv -Path processes.csv
Sorting & Filtering
Get-Process | Sort-Object -Property CPU Get-Process | Where-Object { $_.CPU -gt 10 }