PowerShell Commands to Discover the Server Network, Netmask, DHCP status, and Gateway

$servername = "SERVER01"

get-wmiobject win32_networkadapterconfiguration -computername $servername -ea stop | ? {$_.IPEnabled}

# Result:

DHCPEnabled      : False

IPAddress        : {10.10.10.10}

DefaultIPGateway : {10.10.10.254}

DNSDomain        :

ServiceName      : netvsc

Description      : Microsoft Hyper-V Network Adapter

Index            : 0

(get-wmiobject win32_networkadapterconfiguration -computername $servername -ea stop | ? {$_.IPEnabled}).IPSubnet

#Result:

255.255.255.0

Leave a Reply

Your email address will not be published. Required fields are marked *