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

Deploying LDAP / Active Directory Self Service Password Portal

Overview: There are several choices of platforms to deploy Password Manager: Kubernetes, Docker, Windows, and…

PowerShell: Command Line to Empty a Remote Directory

PowerShell Method $remoteUncPath="\\FILESHERVER01\FOLDER01"$emptyDirectory="C:\emptyDirectory"md -Force $emptyDirectoryRemove-Item "$emptyDirectory`\*" -force -recurse -ErrorAction Continuerobocopy $emptyDirectory $remoteUncPath /mir /R:0 /W:0…

Docker DRUPAL Container

# Preseed drupal files with persitent storagemkdir /var/www/html/kimconnect/{modules,profiles,sites,themes}docker run --rm drupal tar -cC /var/www/html/sites .…