Jump to content

Beginner having issues with cleanup


Recommended Posts

Everyone,

First I want to thank Aaron for having a great site and forum that explains everything with unattended setups. I have a complete Windows 2000 Server CD with all the fixins' :) setup and ready to go. The only issue I am having is that my cleanup.cmd does not run correctly (it does run). Here is the code first:

cmdow @ /HID

shutdown.exe /L /R /T:60 /C "Windows 2000 will now restart in 1 minute..."

sleep.exe 20

RD /S /Q %systemdrive%\Installs\

EXIT

Now I know my runonceex key and the cleanup.cmd execution is correct because the Installs folder does delete. My problem is that the shutdown.exe never kicks off (no shutdown window and no "Windows 2000" text, so I have to manually reboot the machine. At first I did not have any delay between the shutdown line and the remove directory line so I thought maybe that was the issue since the cleanup.cmd eats itself, but that was not the issue. I have tried wait.exe and as you see above sleep.exe. I have even run the cleanup.cmd manually and it works. Any ideas? Nothing in the event log.

HokieForever

Link to comment
Share on other sites


If I did not put in the sleep I would get an explorer.exe error and explorer.exe would crash. I only need currently two lines of code in my cleanup, the shutdown and the remove directory line do destroy the installs file. If I take the sleep out it does not work.

HokieForever

Link to comment
Share on other sites

This is a part of my cleanup code. This will restart the computer in 60 secounds and delete install folder. Plus I gave you some of my other cleanup codes.

cmdow @ /HID
@echo off

rem Cleanup desktop.
del /s /q "%UserProfile%\Desktop\*.lnk"
del /s /q "%AllUsersProfile%\Desktop\*.lnk"

rem Removing temp files.
for /d %%g in ("%temp%\*") do rd /s /q "%%g"
for %%g in ("%temp%\*") do del /s /q "%%g"
for /d %%g in ("%windir%\Downloaded Installations\*") do rd /s /q "%%g"
for %%g in ("%windir%\Downloaded Installations\*") do del /s /q "%%g"

rem Deleting Install dir.
rd /s /q "%SystemDrive%\Install"

rem Restarting windows in xx secs.
shutdown.exe -r -f -t 60 -c "Restarting Windows. Please wait"

exit

The only thing I execute from the command file after sending the restart command is to delete the current file. (it does not resist in %SystemDrive%\install).

Link to comment
Share on other sites

Shutdown option is not working for me either... I've used two shutdown methods (2 different applications - the XP version and a version a friend wrote - both DO NOT work). Here's my code:

"shutdown.cmd"

cmdow @ /HID
C:\WINDOWS\system32\shutdown.exe -r -f -t 30 -c "WinXP Autoinstall will restart in 30 seconds..."

RD /S /Q %systemdrive%\install
RD /S /Q %systemdrive%\Drivers

DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"

EXIT

Here's my RunOnceEx.cmd:

cmdow @ /HID
@echo off

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

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

REG ADD %KEY%\001 /VE /D "Installing VNC4" /f
REG ADD %KEY%\001 /V 1 /D "%systemdrive%\install\vnc4\Install_local.bat" /f

REG ADD %KEY%\005 /VE /D "Copy Citrix Icons" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\install\citrix_icons.cmd" /f

REG ADD %KEY%\010 /VE /D "Installing Citrix" /f
REG ADD %KEY%\010 /V 1 /D "%systemdrive%\install\citrix\ctxsetup.exe" /f

REG ADD %KEY%\015 /VE /D "REMDR Program" /f
REG ADD %KEY%\015 /V 1 /D "%systemdrive%\install\citrixinstallglitch.cmd" /f

REG ADD %KEY%\020 /VE /D "Microsoft Media Player 10" /f
REG ADD %KEY%\020 /V 2 /D "%systemdrive%\Install\MediaPlayer10\mp10setup.exe /q:A /c:\"setup_wm.exe /Q /R:N /DisallowSystemRestore\"" /f

REG ADD %KEY%\022 /VE /D "HMTCD Wizard" /f
REG ADD %KEY%\022 /V 1 /D "%systemdrive%\Install\HMTCDWizard_enu.exe /passive /norestart" /f

REG ADD %KEY%\025 /VE /D "Install CMDhere" /f
REG ADD %KEY%\025 /V 1 /D "\"%systemdrive%\Install\CmdHere Powertoy For Windows XP.msi\" /qb" /f

REG ADD %KEY%\028 /VE /D "Install Firefox 1.06" /f
REG ADD %KEY%\028 /V 1 /D "%systemdrive%\Install\firefox-1.0.6-en_US.msi /qb" /f

REG ADD %KEY%\030 /VE /D "Install QuickTime 7" /f
REG ADD %KEY%\030 /V 1 /D "%systemdrive%\Install\QuickTimeInstaller.exe /S /v/qn" /f

REG ADD %KEY%\040 /VE /D "Install Adobe Reader 7" /f
REG ADD %KEY%\040 /V 1 /D "%systemdrive%\Install\AdbeRdr70_enu_full.exe /S /v/qn" /f

REG ADD %KEY%\050 /VE /D "Modify Default User Registry" /f
REG ADD %KEY%\050 /V 1 /D "%systemdrive%\Install\modifyhive.cmd" /f

REG ADD %KEY%\060 /VE /D "15 Second Shutdown script" /f
REG ADD %KEY%\060 /V 1 /D "%systemdrive%\Install\shutdown.cmd" /f

EXIT

PLEASE HELP!!!

Link to comment
Share on other sites

i would open a command prompt and tpe shutdown and then press return.

What result do you get? You should get the parameters it uses. If not do you have a copy of shutdown.exe on your pc? if not expand from your cd to system32 and should be ok.

Then i would test a really basic one like

shutdown.exe -t 30

Does that work? yes, add each arguement in turn and test as i would expect an arguement to be failing.

Link to comment
Share on other sites

The weird thing is that it works everywhere. It just doesn't work while on RunOnceEx for some reason. Reboot option doesn't launch and am stuck with restarting manually (Gosh I sound so lazy!).

Actually... it's weird, because it WILL run on RunOnceEx, but only when it's not a new installation. Example... I created a RunOnceEx that copied the shutdown.exe to the system32, and launched shutdown with the options above. Worked just fine (on a pre-configured system). Copied that same code (made a couple of path switches - very minimal), created my .ISO tested it on a Virtual Machine and this doesn't restart. Burnt the ISO to CD thinking maybe it's something with VM (just for kicks).. doesn't work anywhere.. but the code is what you see above.

Huh!

i would open a command prompt and tpe shutdown and then press return.

What result do you get?  You should get the parameters it uses.  If not do you have a copy of shutdown.exe on your pc?  if not expand from your cd to system32 and should be ok.

Then i would test a really basic one like

shutdown.exe -t 30

Does that work? yes, add each arguement in turn and test as i would expect an arguement to be failing.

Link to comment
Share on other sites

UPDATE!!!

I ran my script to shutdown with a pause to see any errors and found that the users (Which is Administrator) doesn't have Rights (Somehow) to restart the machine. But it does have Rights to install anything he wants.

This is highly annoying. Anyone can help, please?... (am almost finished with my CD!)

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...