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

PowerShell: Obtain Computer Account Parent Container from Invoke-Command

# ObtainComputerAccountParentContainer.ps1# This is a demonstration of how to pass function into an invoke-command as…

NaN

- Meaning: Not a Number - When used as an assignment to an element index…

PowerShell: Automatically Fix SQL Server by Killing Long Running Queries

# autofixSqlLongRunningQueries.ps1 # version 0.01 # This version is limited to SQL Server Localhost execution,…