Advertisement

06.03.2008 at 11:58AM PDT, ID: 23454256
[x]
Attachment Details

NetSH commands not taking affect when run in batch file from "RunOnce" registry key

Asked by ggrabows in Microsoft Operating Systems, Windows Networking, Windows Batch Scripting

Tags: Microsoft, Windows, 2003

I want to be able to set the IP on a server on it's first boot.  I'm trying to do this via a cmd file set to run via the RunOnce registry key.

The batch file does run, and does report as OK on each command, but and ipconfig at the end of the batch file reports the IP information as being unchanged.

If I run the batch file manually, after being fully logged in, it runs without a problem and the IP configuration settings are retained.Start Free Trial
1:
2:
3:
4:
5:
netsh interface ip set address name="Local Area Connection" static 192.168.1.10 255.255.255.0 192.168.1.1 1
netsh interface ip add dns "Local Area Connection" 192.168.1.10
netsh interface ip add dns "Local Area Connection" 192.168.1.11 index=2
ipconfig/all
pause
[+][-]06.04.2008 at 12:12AM PDT, ID: 21707581

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Operating Systems, Windows Networking, Windows Batch Scripting
Tags: Microsoft, Windows, 2003
Sign Up Now!
Solution Provided By: RobSampson
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.04.2008 at 04:00PM PDT, ID: 21714966

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628