RunOnce

G

Guest

I have been trying to configure my winxpe image to run a batch file upon
bootup but have not been able to. I have followed these steps:

1) Batch file, cfgip.bat, placed in root directory - just to make things
simple for now.
2) Added Extra Resources->RunOnce Request. RunOnce arguments = . RunOnce
FilePath = %11%\cmd.exe /c d:\cfgip.bat. RunOnce flag = 2. Also tried
FilePath = %24%\cfgip.bat, flag = 1, but the fbalog.txt file turned up an
error - "cfgip.bat error code 0x1.

The batch file simply changes the ip address to a static address:
netsh interface ip set address name="Local Area Connection" source=static
addr=192.168.10.2 255.255.255.0 192.168.10.1 1
netsh interface ip set dns name="Local Area Connection" static 192.168.10.1
primary

After allowing the image to come up, checking the ip address shows that it
has not been changed. If I then run the batch file, it does change. So, it is
as if the batch file is not actually being executed. I have tried RunOnce
flags 0-2 with no luck. Also tried starting the batch via cmd.exe - no luck.
I am sure it is something I am doing wrong, just not sure what. Note, that
the image does not have any logins, simply comes up to the desktop.

Any help appreciated.

Thanks,

Lloyd
 
G

Guest

RunOnce-Flag 2 means RunOnceEx like Explorer. So your command will be
"processed only once, by the Explorer shell, after the first logon".

I am sure it is something I am doing wrong, just not sure what. Note, that
the image does not have any logins, simply comes up to the desktop.
Are you using minLogon? Maybe that is the reason, why your command is
not executed.

You may try RunOnce-Flag 1, so it will be executed by the FBA.
Another option is to use "generic command", so that you can be sure that
network is up when starting the script, for example with a phase around
11500.


Best regards
Romuald Thiéry
 
K

KM

Lloyd,
1) Batch file, cfgip.bat, placed in root directory - just to make things
simple for now.
2) Added Extra Resources->RunOnce Request. RunOnce arguments = . RunOnce
FilePath = %11%\cmd.exe /c d:\cfgip.bat. RunOnce flag = 2. Also tried
FilePath = %24%\cfgip.bat, flag = 1, but the fbalog.txt file turned up an

Stick to CMD when you want to deal with batch files.

You should try RunOnce request:
FilePath = %11%\cmd.exe /c d:\cfgip.bat, Flag = 1
(or whatever path to the batch file where you actually store it on
the disk)


FBA Generic command is probably more appropriate for running a network
configuraiton batch script as it gives you more control over the momemnt you
launch the script during FBA.
error - "cfgip.bat error code 0x1.


Regards,
KM
 
G

Guest

Thanks for the suggestion. I changed the image to use the Generic Command and
at least see the batch file execute. I used the cmd.exe /k option so that the
cmd window stays open. It seems that I am running the netsh commands too soon
- I rx an error that the interface does not exist. I have the phase set to
12000 - should this be a higher value?

Lloyd
 
K

KM

Lloyd,

I'd say 12000 is enough and by that time network components should be
already installed.
Do you see any errors reported by the netsh script you run? Or, better, can
you issue ipconfig and other network commands from within the same CMD
window to see if the network stack got install and up and running?

Regards,
KM
 
G

Guest

The error that is reported is as follows:
"Invalid interface Local Area Connection specified."

If I run ipconfig once the batch file has halted, it indicates that the
media state for both Ethernet adaptor Local Area Connection and Ethernet
adaptor Local Area Connection 2 is Media Disconnected.

If I then allow the install complete and run the batch again, it runs
without issue and configures the connections.
 
K

KM

Lloyd,

In your batch file you may want to add the following line to run *prior* the netsh command:
rundll32 netshell.dll HrRenameConnection

This will make sure to register Local Area Connection network connection name even if Explorer has never been run yet (Explorer
usually registers this).
 
G

Guest

That fixed my problem. With the addition of the rundll32 call, the connection
information does get updated.

Thank you for leading me through this.

Lloyd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top