PowerShell Script to Add Static IP and DNS Suffixes to the Client system.

Posted on: December 10, 2012

NCPA.CPL How many people knows this ? If you are a system administrator , you defininately know this.

It’s indeed a tedious task to go to the NIC ——>Property and put the IP address , DNS Address and DNS Search Suffixes , Wins Address Manually . So , I though lets build a PowerShell script which will make administrator life easy . Below is the script

$IP = Read-Host “Please Enter the IP Address”
$Subnet = Read-host “Please Enter the SubnetMask”
$default = Read-host “Please Enter DefaultGateway”
$dns = “”,”″
$DNSsuffix =  “”,””
$a = Get-WmiObject -Class win32_networkadapterconfiguration -Filter “IPEnabled = true”
$a.EnableStatic($IP , $Subnet)
invoke-wmimethod -Class win32_networkadapterconfiguration -Name setDNSSuffixSearchOrder -ArgumentList @($DNSSuffixes),$null 

Script should be modified according to your environment. Below are the which one need to modify

$dns = “”,”″
$DNSsuffix =  “”,””

Read – host command line will ask you to provide IP address,SubnetMask,Defaultgateway in CMD Prompt

Hope this script will help to remove manual work





1 Response to "PowerShell Script to Add Static IP and DNS Suffixes to the Client system."

Hello, Neat post. There’s an issue along with your
site in web explorer, might test this? IE still is the marketplace chief
and a big section of folks will leave out your magnificent writing due to this problem.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: