Networking Management

Local Access

Windows Built-In

# Network interface settings
ipconfig /all
# ARP table (ARP translates IPs to MACs)
arp -a
# DNS queries
nslookup ACADEMY-ICL-DC
# Open ports
netstat -an

Net Cmdlets

Cmdlet
Description

Get-NetIPInterface

Retrieve all visible network adapter properties.

Get-NetIPAddress

Retrieves the IP configurations of each adapter. Similar to IPConfig.

Get-NetNeighbor

Retrieves the neighbor entries from the cache. Similar to arp -a.

Get-Netroute

Will print the current route table. Similar to IPRoute.

Set-NetAdapter

Set basic adapter properties at the Layer-2 level such as VLAN id, description, and MAC-Address.

Set-NetIPInterface

Modifies the settings of an interface to include DHCP status, MTU, and other metrics.

New-NetIPAddress

Creates and configures an IP address.

Set-NetIPAddress

Modifies the configuration of a network adapter.

Disable-NetAdapter

Used to disable network adapter interfaces.

Enable-NetAdapter

Used to turn network adapters back on and allow network connections.

Restart-NetAdapter

Used to restart an adapter. It can be useful to help push changes made to adapter settings.

test-NetConnection

Allows for diagnostic checks to be ran on a connection. It supports ping, tcp, route tracing, and more.

# Listing only IPv4 interfaces
Get-NetIPInterface -AddressFamily IPv4
# Disabling DHCP
Set-NetIPInterface -InterfaceIndex 25 -Dhcp Disabled
# Setting a static IP
Set-NetIPAddress -InterfaceIndex 25 -IPAddress 10.10.10.10 -PrefixLength 24
# Restarting network adapter
Restart-NetAdapter -Name 'Ethernet 3'
# Testing connectivity
Test-Connection

Remote Access

SSH

# Checking if OpenSSH client and server are installed
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*
# Installing 
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Starting the service
Start-Service sshd 
Set-Service -Name sshd -StartupType 'Automatic' 

WinRM

Enabled by default on Windows Servers.

# Enabling WinRM
winrm quickconfig
# Testing WinRM (no auth -> no OS version)
Test-WSMan -ComputerName "10.10.10.10"
# Testing WinRM (auth -> OS version)
Test-WSMan -ComputerName "10.10.10.10" -Authentication Negotiate
# Establishing a WinRM session
Enter-PSSession -ComputerName "10.10.10.10" -Credential <user> -Authentication Negotiate

Last updated