This may be my first post, but i must admit that this forum ahs already helpded me out so much already, so a BIG thank you to start with!

My task at hand is to provide the ability to 're-image' a remote device ad-hoc, when the windows OS becomes corrupt (happens fairly often!).

I have created a Winpe3.0 boot.wim, which i have been able to inject all my NIC drivers and the Script packages so when our device does PXE boot via TFTPD32 it discovers its own IP address, maps a drive to a local computer (where the image will be stored) and loads VNC. This all works perfectly, and i am in the stage of a live trial now.

The issue i have now is that the people that will be using this tool will be doing so via a simple interface (simple DOS menu structure ATM). This DOS structure will prompt the analyst what machine they are trying to PXE boot and guide them along the way.

The final stumbling point i have got to now is changing the TFTpd32.ini file (or registry entry) to reflect the local network IP structure. This is key especially for VNC for i need to ensure the WinPE environment knows where the local default gateway is, so the analyst can VNC in a reimage (if needed). The server machine that will run the TFTpd32 on the local machine will have a local IP address, this allows me to write a script that can assertain variables to set the IPPool and Default gateway.

The final stumbling point i have got to now is changing the TFTpd32.ini file (or registry entry) to reflect the local network IP structure. This is key especially for VNC for i need to ensure the WinPE environment knows where the local default gateway is, so the analyst can VNC in a reimage (if needed). The server machine that will run the TFTpd32 on the local machine will have a local IP address, this allows me to write a script that can assertain variables to set the IPPool and Default gateway.

Actaully, i might not be reading that right, i dont need the script within the PE environment, i need to be able to script this on a WinXP box. This script will be hosting the repair image, Boot Wim and TFTpd32. I have a simple Batch (with some VBS) that an analyst can run when needed?

Sounds like an interesting project. I've already done something you might be able to use but it's not dos. It can be driven from ordinary batch files though but it's 32-bit win32 command line. It has lots of command switches.

If you intend picking up the 32 bit networking details then this may not be as easy from a 16 bit dos script anyway.

Check out TFTPLaunch which can launch and auto-configure tftpd32 from a batch file. I needed a similar gizmo and decided to write on in "C" (the maths is a bit fiddly and some of the values are stored in network-endian format) You will also run into some bugs with tftpd32 with respect to it's config file handling. I found them non resolvable within tftpd32.

I was inspired to write a small 32-bit "C" console app to do this type of math which can be used to set the environment variables directly. I like to have stuff like this in my toolkit and it didn't take too long to do (and I needed a break from PXE stuff!)

1 question i did have is that because i am calling this within a script, it opens it's own CMD prompt to run, but doesn't close this prompt. Due to the looping back i cant see where i need to put the 'exit' statement in so it closes itself down nicely?

1 question i did have is that because i am calling this within a script, it opens it's own CMD prompt to run, but doesn't close this prompt. Due to the looping back i cant see where i need to put the 'exit' statement in so it closes itself down nicely?

You normally do not need an EXIT statement (which however would go here):