Solved

powershell script for setting windows ip addresses subnet and gateway and dns

Posted on 2011-09-30
10
1,055 Views
Last Modified: 2012-05-12
been googleing for a powershell script to set up all the ip address stuff for virtual 2008 r2 in a vmware 4.1 enviroment so i can use a script for a forth coming vitual server build / migration prject
0
Comment
Question by:IanTh
  • 4
  • 3
10 Comments
 
LVL 6

Accepted Solution

by:
Reubenwelsh earned 500 total points
ID: 36890758
you can use NETSH to set the network config, it isnt really powershell but you can use it in Powershell just the same.

See here for how to do it: http://www.petri.co.il/configure_tcp_ip_from_cmd.htm
0
 
LVL 30

Author Comment

by:IanTh
ID: 36890763
what if the virtual server has multiple nics
0
 
LVL 6

Expert Comment

by:Reubenwelsh
ID: 36890835
Is there any logic in the network card names?
0
 
LVL 30

Author Comment

by:IanTh
ID: 36890862
no its basically going to be something like a script that sets up the ip address the subnet and gateway with defaults for subnet 255.255.255.0 if nothing entered


if second nic is required press yes

insert ip adress for second nic


etc
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 6

Assisted Solution

by:Reubenwelsh
Reubenwelsh earned 500 total points
ID: 36890895
Ah ok... that makes it harder, when we did somthig like this i just copy pasted commandlines that set all the settings, dont really see the point of having popup dialougs, i just had an excelsheet ready and copy pasted from left screen to right screen, everything ready so no need to do any typing.
0
 
LVL 30

Author Comment

by:IanTh
ID: 36891084
I am trying to setup script for a vmware 2008 r2 project that I am currently working on for the next part that I am trying to script a lot to cut down on finger trouble putting wrong details in asx the gateway and dns will not change just the ip address but thde servers will have multiple nics
0
 
LVL 30

Author Closing Comment

by:IanTh
ID: 37197867
didn't answer fully
0
 
LVL 118
ID: 37449336
Ian

Have a look at this

One line!


 
Get-VM VMName | Get-VMGuestNetworkInterface -GuestUser Administrator -GuestPassword <password> -HostUser root -HostPassword <password> | Set-VMGuestNetworkInterface -IPPolicy Static -Ip <IPAddress> -Netmask 255.255.252.0 -Gateway <Gateway> -GuestUser Administrator -GuestPassword <password> -HostUser root -HostPassword <password>

Open in new window


Also checkout Set-VMGuestNetworkInterface Options for DNS etc

http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/Set-VMGuestNetworkInterface.html
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Teach the user how to edit .vmx files to add advanced configuration options Open vSphere Web Client: Edit Settings for a VM: Choose VM Options -> Advanced: Add Configuration Parameters:
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.

943 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now