Skip to content

Windows

Windows

Export DNS on Windows

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

  1. Browse to C:\Windows\System32\dns
  2. Create a folder called export
  3. Open a command prompt and browse to C:\Temp
  4. Run the following commands:
dnscmd /enumzones > AllZones.txt
for /f %a in (AllZones.txt) do dnscmd /ZoneExport %a export\%a.txt

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

.\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