This page will be consistently updated with powershell one liners I find useful in certain situations. Maybe it’ll be helpful to you? Maybe not?
Situation:
The RMM tool I use will allow Powershell access to a device without interrupting the user. I needed to check to see if a port was opened on a remote site from a network the host was on. Telnet wasn’t enabled on this host.
Command:Test-NetConnection -ComputerName google.com -Port 443
Situation:
Migrating DHCP from Windows Domain Controller to Firewall appliance. DHCP configuration on Domain controller handing out dhcp for multiple different networks, has over 100 reservations. Do not want to copy over manually. The below powershell command exports all reservations from every network scope and dumps into CSV file.
Command:
(Get-DhcpServerv4Scope).scopeid.IPAddressToString | foreach {Get-DhcpServerv4Reservation -ScopeId $_ | Export-Csv -NoTypeInformation -Path C:\temp\dhcpreservations.csv -Append}