Posted On June 7, 2019

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

kimconnect 0 comments
blog.KimConnect.com >> Codes >> 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 *

Related Post

Basic JavaScript: Understanding Uninitialized Variables

// Initialize these three variablesvar a;var b;var c;// Do not change code below this linea…

The 10 Commandments of C Programming

Source: some ancient programming god Thou shalt run lint frequently and study its pronouncements with…

PowerShell: Start IIS Sites & App Pools

Before running the below script, it's necessary to mark certain IIS App pools and websites…