[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2011-09-30
10
Medium Priority
?
1,065 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
10 Comments
 
LVL 6

Accepted Solution

by:
Reubenwelsh earned 1500 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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
 
LVL 6

Assisted Solution

by:Reubenwelsh
Reubenwelsh earned 1500 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 123
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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
In this video tutorial I show you the main steps to install and configure  a VMware ESXi6.0 server. The video has my comments as text on the screen and you can pause anytime when needed. Hope this will be helpful. Verify that your hardware and BIO…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

650 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