?
Solved

How to create multiple (hundreds) IP address using powershell in single Windows Server VM ?

Posted on 2010-04-08
2
Medium Priority
?
461 Views
Last Modified: 2012-08-13
Hi All,

I'd like to perform a database application transactional and concurrent load testing which requires approx. 100 IP address in a single host (Windows box)
is there any quick way (Powershell 2.0 / netsh ) to create those IP address in one single box ?

ex.

Simulator1 - 10.2.1.1

10.2.1.2
10.2.1.3
10.2.1.4
10.2.1.5
.
.
.
10.2.1.102

Simulator2 - 10.2.2.1

10.2.2.2
10.2.2.3
10.2.2.4
10.2.2.5
.
.
.
10.2.2.102

i know how to do it in Windows Server 2003 manually one by one but that's too daunting to do it manually.

Thanks
0
Comment
Question by:jjoz
2 Comments
 
LVL 24

Assisted Solution

by:B H
B H earned 2000 total points
ID: 30161992
how about a batch file, adjust fire as necessary on the subnet/ip's

netsh in ip add address "Local Area Connection" 10.2.1.2 255.0.0.0
netsh in ip add address "Local Area Connection" 10.2.1.3 255.0.0.0
netsh in ip add address "Local Area Connection" 10.2.1.4 255.0.0.0
netsh in ip add address "Local Area Connection" 10.2.1.5 255.0.0.0
netsh in ip add address "Local Area Connection" 10.2.1.6 255.0.0.0
...etc
0
 
LVL 1

Accepted Solution

by:
jjoz earned 0 total points
ID: 30557042
here it is the script that works:

#setup collection of IP address strings, include original IP
$ips = 1..100 | %{ "10.2.1.$_" }

#also subnet masks, need as many as IP addresses
$masks = 1..100 | %{ "255.255.255.0" }

#get the NIC
$nic = Get-WMIObject win32_networkadapterconfiguration -computer VM-Simulator1 | where { $_.IPAddress -contains "10.2.1.1" }

#set addresses
$nic.EnableStatic($ips,$masks)
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question