banner
 

Path: content/Tips/Windows/default.md

Windows

Export DNS on windows

To generate a bind-compatible export file from a windows DNS server:

In the export folder you will now have a text file with an export for every zone (forward & reverse) in your DNS server.

top equivalent in powershell

While(1) {ps | sort -des cpu | select -f 15 | ft -a; sleep 1; cls}

Get Processes and IIS sites running

PS C:\Windows\System32\inetsrv> .\appcmd.exe list wp

Get-Process | Select-Object Name,@{Name='WorkingSet';Expression={($_.WorkingSet/1KB)}} | Select-String w3wp

Get-Process | Group-Object -Property ProcessName |  Format-Table Name, @{n='Mem (KB)';e={'{0:N0}' -f (($_.Group|Measure-Object WorkingSet -Sum).Sum / 1KB)};a='right'} -AutoSize

Get / Set firewall rules

Get-NetFirewallRule -DisplayName "firewallrulename"

New-NetFirewallRule -DisplayName "firewallrulename" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow

Powershell curl

Curl is usually set up as an alias for Invoke-WebRequest:

curl http://localhost:80/status -UseBasicParsing

Event Logs

Get-EventLog -list - lists the event log categories

Get-EventLog Application - dumps the application log

Last updated : 14 November 2024