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: Purge, Destroy, or Empty a Directory!

# WARNING: THIS IS A VERY DESTRUCTIVE FUNCTION. IF EXECUTED AT THE WRONG DIRECTORY WHERE…

Hyper-V Servers Report

# hyperVServersReport.ps1 # Version: 0.0.1 # Description: # This script will scan for Hyper-V Hosts…

PowerShell: Process Watcher – Perform CRM Async Services Maintenance

Update: this script is deprecated in favor of a better one here. Version 1: #…