Here's a script I call at the end of startnet.cmd. The goal here is to connect to \\MYSERVER\MYSHARE and run a menu script stored there. If the script can't be found I release and renew my IP address and try again.
echo OFF
set INSTALL_SERVER=MYSERVER
set INSTALL_SHARE=MYSHARE
set INSTALL_ACCOUNT=INSTALLUSERNAME
set INSTALL_PASSWORD=12345678
set INSTALL_ACCOUNT_DOMAIN=MYSERVER
set START_SCRIPT=menu.cmd
:NETWORK_LOGON
echo.
echo.
echo Logging on to %INSTALL_SHARE% on %INSTALL_SERVER%
echo as %INSTALL_ACCOUNT_DOMAIN%\%INSTALL_ACCOUNT%...
Here's a ping to provoke name resolution,
ping 0.0.0.1 -n 3 -w 1000 > NUL
ping %INSTALL_SERVER% > NUL
Here's the logon attempt from WinPE to the server,
net use \\%INSTALL_SERVER%\%INSTALL_SHARE% /user:%INSTALL_ACCOUNT_DOMAIN%\%INSTALL_ACCOUNT% %INSTALL_PASSWORD%
pushd \\%INSTALL_SERVER%\%INSTALL_SHARE%
if exist %START_SCRIPT% call %START_SCRIPT%
If I can't see the menu script, then I release and renew and try again,
if not exist %START_SCRIPT% (
ipconfig /release
ipconfig /renew
goto :NETWORK_LOGON
)