Jump to content

Running batch file from GuiRunOnce doesnt complete


Recommended Posts

I am running a batch file from GuiRunOnce. The batch file takes about 2 minutes or so to complete if ran by hand, and completes with no issues. It installs several pieces of software, and does some quick checks to see if certain hotfixes are installed. When GuiRunOnce comes up after install, I see it kick off the batch file, but it finishes very quickly, with no obvious errors, and none of the software is installed. Here are the contents of the RunOnceEx.cmd:

@echo off

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\005 /VE /D "install.bat" /f

REG ADD %KEY%\005 /V 1 /D "%systemdrive%\AP\install.bat" /f

REG ADD %KEY%\010 /VE /D "Sanupdate.bat" /f

REG ADD %KEY%\010 /V 1 /D "%systemdrive%\SanKit\5.26\InstallScript\sanupdate.bat" /f

EXIT

sanupdate.bat is the one that is having the issue.

Link to comment
Share on other sites


Just so we're on the same page here... the code you posted should take a fraction of a second to run and I'm guessing it runs fine. The sanupdate.bat file that you mentioned is having problems is running from RunOnceEx. Since GuiRunOnce and RunOnceEx kick off at essentially the same time and you're intructing RunOnceEx to launch sanupdate.bat, then you'll have to reboot for sanupdate.bat to run.

I would suggest running the code you posted from cmdlines.txt if you want the RunOnceEx settings to take effect after the first reboot.

Link to comment
Share on other sites

Maybe I am confused. Here is the contents of my cmdlines.txt:

[COMMANDS]

"RunOnceEx.cmd"

It just kicks off RunOnceex.cmd, which I posted earlier. RunOnceex.cmd will run install.bat and sanupdate.bat on first logon (I have autologon enabled and autologoncount set to 1). Shouldnt this just run install.bat and sanupdate.bat?

Link to comment
Share on other sites

I am running a batch file from GuiRunOnce. The batch file takes about 2 minutes or so to complete if ran by hand, and completes with no issues.

@echo off

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\005 /VE /D "install.bat" /f

REG ADD %KEY%\005 /V 1 /D "%systemdrive%\AP\install.bat" /f

REG ADD %KEY%\010 /VE /D "Sanupdate.bat" /f

REG ADD %KEY%\010 /V 1 /D "%systemdrive%\SanKit\5.26\InstallScript\sanupdate.bat" /f

EXIT

sanupdate.bat is the one that is having the issue.

Perhaps this where I was confused. It seemed as though you were saying that the code above was running from GuiRunOnce.

Maybe I am confused. Here is the contents of my cmdlines.txt:

[COMMANDS]

"RunOnceEx.cmd"

It just kicks off RunOnceex.cmd, which I posted earlier. RunOnceex.cmd will run install.bat and sanupdate.bat on first logon (I have autologon enabled and autologoncount set to 1). Shouldnt this just run install.bat and sanupdate.bat?

RunOnceex.cmd, if it's code from post #1, will not run the batch files, but rather it will set them to run from RunOnceEx. So it does not appear as though anything is running from GuiRunOnce - at least not from what you've described thus far. If there is a problem with sanupdate.bat, then perhaps you would like to post that code. How and when are you getting the SanKit\5.26\InstallScript directory on to your system drive?

Link to comment
Share on other sites

I have the directories in the $oem$\$1\ folder:

$oem$\$1\AP\

$oem$\$1\SanKit\

I must be confused about the GuiRunOnce. I thought the RunOncecmd was GuiRunOnce (disregard my ignorance). The code at the top is from the RunOnceex.cmd file. The sanupdate.bat runs fine if ran manually, so I dont think its something with the script. I just need these 2 batch files to run to install the san software on the machines. Is this not the place to do it?

Link to comment
Share on other sites

Well I don't see anything immediately that's wrong with your batch file setting the ROE entries. The only thing I can really think of is that something is not being found. One troubleshooting suggestion for circumstances like this is to verify your target exists. Try inserting an IF EXIST in there to see if "%systemdrive%\SanKit\5.26\InstallScript\sanupdate.bat is found by the batch file.

Link to comment
Share on other sites

The batch files are being found, but arent completing. Could it bebecause something the batch file is looking for under the \SanKit\ directory hasnt been completely copied over yet? (its about 300Meg). Is there a better place to run the batch files automatically?

Link to comment
Share on other sites

If you're copying over everything via $OEM$\$1, then it all get copied during the text mode portion of setup. So it's there long before. This is why I was interested in the batch file. If it's working when run manually, but from RunOnceEx, I figured there may be something of interest to look at.

If there's anything sensitive in the batch file, just XXXX all of that out if you'd like to post it.

Link to comment
Share on other sites

Here are the contents of sanupdate. I just didnt post it because it was large.

@echo off

set rtn=0
set hbaqlcnt=0
set hbaemxcnt=0
set hbacnt=0
set temp=%systemdrive%\temp
set ver=SANDec-14-05
if NOT exist %temp% mkdir %temp% >NUl 2>NUL

if "%1" == "" goto doit
if NOT "%1" == "/f" (
echo Usage -
echo sanupdate
echo or
echo sanupdate /f
echo /f - force update all components
echo.
goto done
)

:doit
echo. > %temp%\SAN_UPDATES.log
echo Log file for SAN updates created on %date% %time% Version %ver% >> %temp%\SAN_UPDATES.log
echo.>> %temp%\SAN_UPDATES.log

systeminfo | find /I "os name" | find /I "2003" >> %temp%\SAN_UPDATES.log

if NOT "%errorlevel%" == "0" (
echo Package not for this system.
echo Package not for this system >> %temp%\SAN_UPDATES.log
set rtn=5
goto done
)

echo. >> %temp%\SAN_UPDATES.log

rem Check for hotfix
cscript /nologo hotfix.vbs | find /i "908980"
if NOT "%errorlevel%" EQU "0" (
echo Hotfix Q908980 not installed. Updated Aborted.
echo Install hotfix , reboot and then rerun updates.
echo Hotfix Q908980 not installed. Updated Aborted. >> %temp%\SAN_UPDATES.log
echo Install hotfix , reboot and then reun updates. >> %temp%\SAN_UPDATES.log
set rtn=4
goto done
)

echo Performing SAN Updates For Emulex HBA's...>> %temp%\SAN_UPDATES.log
echo.>> %temp%\SAN_UPDATES.log




:common
echo.
echo. >> %temp%\SAN_UPDATES.log
echo Installing/Updating Common Applications..
echo Installing/Updating Common Applications.. >> %temp%\SAN_UPDATES.log
echo. >> %temp%\SAN_UPDATES.log
echo Quering All HBA's ...
device count allhba-ids.txt
set hbacnt=%errorlevel%
echo Number of HBA cards detected : %hbacnt%
if "%hbacnt%" == "0" (
echo No HBA controllers found in this server.
echo No HBA controllers found in this server. >> %temp%\SAN_UPDATES.log
echo. >> %temp%\SAN_UPDATES.log
echo SAN update not performed.
echo SAN update not performed. >> %temp%\SAN_UPDATES.log
set rtn=5
goto done
)


if /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
set snapacks=pe-Navisphere_agent pe-powerpath32
) else if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set snapacks=pe-Navisphere_agent pe-powerpath64
) else if /I "%PROCESSOR_ARCHITECTURE%" == "IA64" (
set snapacks=pe-Navisphere_agent pe-powerpathia64
) else (
echo Package not for this system.
echo Package not for this system >> %temp%\SAN_UPDATES.log
set rtn=5
goto done
)

set displaynames=Navisphere_Agent PowerPath

REM back up navisphere configuration file
if exist %temp%\agent.config (
del /S /Q %temp%\agent.config 2>NUl 1>NUL
)

if exist "%ProgramFiles%\EMC\Navisphere Agent\agent.config" (
copy "%ProgramFiles%\EMC\Navisphere Agent\agent.config" %temp%\agent.config 2>NUl 1>NUL
)

set lice=
if %hbaqlcnt% GTR 1 (set lice=XXXX-XXXX-XXXX-XXXX-XXXX)
if %hbaemxcnt% GTR 1 (set lice=XXXX-XXXX-XXXX-XXXX-XXXX)

Rem execute all the update packs
for %%i in (%snapacks%) do call :execpacks %%i %lice%
if "%rtn%" == "" goto EOF

REM restore navisphere configuration file
copy /Y agent.config "%ProgramFiles%\EMC\Navisphere Agent" 2>NUl 1>NUL



::if /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
:: rem installing powerpath patch
:: start /wait EMCPP.W2003_32.4.3.1.P1.b114.exe /s /fe /v"/q REBOOT=ReallySuppress"
::) else if /I "%PROCESSOR_ARCHITECTURE%" == "ia64" (
:: start /wait EMCPP.W2003_64.4.3.1.P1.b114.exe /s /fe /v"/q REBOOT=ReallySuppress"
::)


)

rem installing powerpath efix
if /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
echo Installing PowerPath Efix
echo. >> %temp%\SAN_UPDATES.log
echo Installing PowerPath Efix >> %temp%\SAN_UPDATES.log
start /wait EMCPower.W2003_32.4.5.0.EF1.GA.exe /s /fe /v"/q REBOOT=ReallySuppress"
) else if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
echo Installing PowerPath Efix
echo. >> %temp%\SAN_UPDATES.log
echo Installing PowerPath Efix >> %temp%\SAN_UPDATES.log
start /wait EMCPower.W2003_X64.4.5.0.EF1.GA.exe /s /fe /v"/q REBOOT=ReallySuppress"
)

Rem install Solutions Enabler



:done
set err=
set hbacnt=
set hbaemxcnt=
set hbaqlcnt=
set lice=
echo return code : %rtn%
echo return code : %rtn% >> %temp%\SAN_UPDATES.log
seterror %rtn%
set rtn=
goto EOF

:execpacks
if "%rtn%" == "" goto EOF
if not exist "%~n1.exe" goto EOF
echo Installing/Updating %~n1 ...
start /wait %1 /s %2
set err=%errorlevel%
type %temp%\%1.log >> %temp%\SAN_UPDATES.log
echo.>> %temp%\SAN_UPDATES.log

if "%err%" == "1" (
echo Error updating %1.
echo Exiting with return code : 1
set rtn=1
goto done
)

:EOF

Edited by B.Bill
Link to comment
Share on other sites

A little more info. I added a log to the batch file and it is complaining about a hotfix not being applied. I added the hotfix to the image with the /integrate option. The batch file calls a vbs script that looks for the hotfixes that have been applied here:

cscript /nologo hotfix.vbs | find /i "908980"

this portion must be failing when running via RunOnceex.cmd. hotfix.vbs is on the %systemdrive% in the same dir as sanupdate.bat. After the system logs in the first time, if I run this by hand, it finds the hotfix with no issues. Any ideas?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...