Partager via


net use failing in RunOnce section of registry

Ugh...horribly frusterating problem today.

I have a WinXP machine that's been sysprep'd.  I'm trying to finish the sysprep with a sysprep.inf file on the a:\  That, for the most part is working fine.

It's when the OS get's the commands I have listed under the GuiRunOnce section of the sysprep.inf file where I'm having trouble.

The command that's in there is as follows..

cmd /c net use z: \\<server>\<share> /u:<server>\administrator <adminpassword>

please take it for granted that the <> have actual good values in it.

When the above command is executed I get "System error 67 has occurred."  Now my first thought is that the server I'm trying to connect to can't be reached for some reason...however, if I change the GuiRunOnce command to this...

cmd /c net use z: \\<server>\<share> /u:<server>\administrator <adminpassword> & pause & net use z: \\<server>\<share> /u:<server>\administrator <adminpassword>

The 2nd net use works perfectly.  If I try to net use manually after winlogon net use works perfectly.  I've been looking all over the net for a solution to this, but I'm not finding anything...I can't think I'm the only person in the world this is happening too...

Incendtally, the EXACT same command works in Win2k3 perfectly every time....this is only happening in WinXP.  Does anyone have any suggestions?

Comments

  • Anonymous
    December 09, 2005
    Sounds to me like the network's not finished intialising when the command's run for the first time.
    Perhaps a sleep 10 or similar would solve the problem or setting the "always wait for network at logon" (imprecisely worded but you get the drift) group policy

  • Anonymous
    December 12, 2005
    Yeah, that seems to have done it. Strange...sure wish I could find something that documents this as a known bug...I suppose I'll have to write a bug on it if I can't...hehehe

  • Anonymous
    June 12, 2007
    Hi there, A sleep command will can the trick.  However, the problem is due to the fact that a service you're attempting to use hasn't fully started yet.  (The timing can appear to be random, but it's not a bug.)  In the case of not being able to map a network drive, the Workstation (lanmanworkstation) service isn't up and running.  This is really what you need to look for in order to proceed reliably. I use the following code in a batch file started called in the [GUIRunOnce] section of Sysprep.inf to make sure that Workstation (lanmanworkstation) and Windows Time (W32Time) are up and running before attempting NET USE and NET TIME commands: --Snip-snip-- @ECHO OFF REM Make sure services are started before attempting to use them. :START_WORKSTATION NET START "lanmanworkstation" 1>NUL 2>NUL IF NOT "%ERRORLEVEL%"=="2" GOTO START_WORKSTATION :START_WINDOWSTIME NET START "W32Time" 1>NUL 2>NUL IF NOT "%ERRORLEVEL%"=="2" GOTO START_WINDOWSTIME REM Change the following lines to point to your server and share, using your administrator account and password: NET USE I: \SERVERSHARE$ /U:Administrator password 1>NUL 2>NUL NET TIME \SERVER /SET /Y 1>NUL 2>NUL REM Insert the rest of your commands below... --End of snippet-- I hope this helps! Steve

  • Anonymous
    July 12, 2007
    How do you know what the  errorlevel info is for Net Start?