Powershell commands


Print wifi stored passwords

netsh wlan show profiles

netsh wlan show profile name="MyWiFiNetwork" key=clear

Update all sw packages from cmd

List all

winget upgrade

Upgrade all

winget upgrade --all

Upgrade specific

winget upgrade "[NameTag]"

Wsl (Linux subsystem for windows)

List version

wsl --list --verbose

update

wsl --update

Get battery report

powercfg /batteryreport /output "$env:USERPROFILE\Documents\battery-report.html"

Ver logins

Exitosos

Get-EventLog Security -InstanceId 4624 | Select -Last 4

Fallidos

Get-EventLog Security -InstanceId 4625 | Select -Last 4

Conexiones remotas asociadas a personas filtrando dwm/umfd y system

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624} | Where-Object { ($_.Properties[8].Value -in 2,3,10) -and ($_.Properties[5].Value -notmatch 'DWM|UMFD|SYSTEM|LOCAL SERVICE|NETWORK SERVICE|ANONYMOUS LOGON') } | Select-Object TimeCreated, @{Name='User';Expression={$_.Properties[5].Value}}, @{Name='LogonType';Expression={$_.Properties[8].Value}}, @{Name='IP';Expression={$_.Properties[18].Value}} | Sort-Object TimeCreated -Descending | Select-Object -First 20

Listar grupos

whoami /groups

Provide with admin privileges

net localgroup Administrators /add username