Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Startup-script to change hostname and IP if not OK

Reply
 
Old 07-23-2009   #1 (permalink)
IUnderstandSomething


 
 

Startup-script to change hostname and IP if not OK

I have a classrom of computers where I use virtual machines with Linux
as host and Win-XP as guests.

After copying a VM they will all have the same hostname. I need a
startup-script that will set the hostname and IP-adress from a premade
INI-file I can store on the Linux-host.

Anyone?

My System SpecsSystem Spec
Old 07-23-2009   #2 (permalink)
Scott


 
 

Re: Startup-script to change hostname and IP if not OK

"IUnderstandSomething" <hke1972@xxxxxx> schrieb im Newsbeitrag
news:5d16f4f0-c690-42fd-b90c-39484f544157@xxxxxx
Quote:

>I have a classrom of computers where I use virtual machines with Linux
> as host and Win-XP as guests.
>
> After copying a VM they will all have the same hostname. I need a
> startup-script that will set the hostname and IP-adress from a premade
> INI-file I can store on the Linux-host.
>
> Anyone?
maybe this helps:
http://stackoverflow.com/questions/5...m-command-line


also netsh is good tool:
http://www.petri.co.il/configure_tcp_ip_from_cmd.htm


you may also try to use DHCP instead of static IP-Nr then no need to change
IP settings

bye


My System SpecsSystem Spec
Old 07-24-2009   #3 (permalink)
Heinz


 
 

Re: Startup-script to change hostname and IP if not OK

"IUnderstandSomething" <hke1972@xxxxxx> schrieb im Newsbeitrag
news:64b97b9a-2a4c-4fee-9bcd-3e8beb86ff59@xxxxxx
Quote:

> Almost there
>
> I used what you said and read up on a lot of other stuff to and ended
> up with this VBS-file:
>
> Const sName="Class2"
> Dim objNet, objShell, strComputerName
> Set objNet = CreateObject("WScript.NetWork")
> strComputerName = objNet.ComputerName
> if sName <> strComputerName then
> set objShell = wscript.createObject("wscript.shell")
> strTmp = "netsh interface ip set address name 'Local Area Connection'
> static 192.168.10.22 255.255.255.0 192.168.10.1"
> objshell.run strTmp,1,true
> strTmp = "netsh int ip set dns 'Local Area Connection' dns 'Local
> Area Connection' static 62.65.30.10"
> objshell.run strTmp,1,true
> strTmp = "B:\newSid.exe /a " & sName
> objshell.run strTmp,1,true
> Set objNet = Nothing
> end if
>
> ??
> I am, as you probably can see, trying to test if the computername is
> as expected. If not to set IP etc. and DNS. Where I have been guessing
> now is at the quates. Because netsh has Local Area Connection in " ,
> but since I am running it with a shell I thought to change them with
> ' , but it does not work.
>
> Ideas??
>
> Thank you!
For the quote problem you can try this :

strTmp = "netsh interface ip set address name " & chr(34) & "Local Area
Connection" & chr(34)


chr(34) stands for " - and I think if you build the string programtically
it maybe works


hth


My System SpecsSystem Spec
Old 08-11-2009   #4 (permalink)
Darryl


 
 

Re: Startup-script to change hostname and IP if not OK

On Jul 23, 7:36*pm, IUnderstandSomething <hke1...@xxxxxx> wrote:
Quote:

> I have a classrom of computers where I use virtual machines with Linux
> as host and Win-XP as guests.
>
> After copying a VM they will all have the same hostname. I need a
> startup-script that will set the hostname and IP-adress from a premade
> INI-file I can store on the Linux-host.
>
> Anyone?
I've been exploring this concept for my schools. How far have you
got?

darryl
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Startup Script Via GPO... Where Are Parameters Stored? VB Script
Script works / but fails on startup VB Script
Shutdown and startup Hyper-V Virtual Machine via script Virtual Server
Computer Startup script being terminated, possibly due to a timeout ? VB Script
Trivial startup script won't run in Vista Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46