Jump to content

Can Anyone Help Me With This?


compstuff

Recommended Posts

When I do my SFX integration I actually call a "finish" cmd that I have in the image that performs a number of other tasks but I am banging my head against a wall because the very last step which is a simple shutdown reboot command doesn't work correctly... I constantly get "windows will shutdown in 1 minute" instead of what I set. If I run the shutdown string at a cmd prompt it runs fine. Can anyone shed some light on this???

 

::


::- - - Section 1 - - - - Block Installations - - - - - - - - - - - - - - - - - - - - - - - - - -
::

::
::- - - Section 2 - - - - Install Programs - - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

::
::- - - Section 3 - - - - Group Policy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

:REM Change group policy folder permissions to allow GP folder copy from install directory

::
::- - - Section 4 - - - - Firewall Settings - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

:REM OPtimum Office Support

:REM Remote Desktop

:REM ICMPv4

::
::- - - Section 5 - - - - IE Settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

::
::- - - Section 6 - - - - Registry Settings - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

start /wait "Registry Settings" /wait "%HOMEDRIVE%\install\Reg\reg.cmd"
timeout /T 15
start /wait "Registry Settings PsExec" /wait "%HOMEDRIVE%\install\Reg\regPsExec.cmd"
timeout /T 15
::
::- - - Section 7 - - - - Active Setup Settings - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

start /wait "Active Setup IE Settings" /wait "%HOMEDRIVE%\install\ActiveSetup\ASIEtweaksAdd.cmd"
start /wait "Active Setup MP Settings" /wait "%HOMEDRIVE%\install\ActiveSetup\ASMPtweaksAdd.cmd"
timeout /T 15
::
::- - - Section 8 - - - - RunOnce Settings - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

REGEDIT /S "%HOMEDRIVE%\install\RunOnce_WU_Satisfy.reg"
echo installed 3rd reboot RunOnce_WU_Satisfy.reg
timeout /T 15
::
::- - - Section X - - - - Time Stamp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
REG ADD %KEY% /V "102 Time Stamp" /D "%HOMEDRIVE%\INSTALL\timestamp.cmd" /f
echo timestamp created
timeout /T 15
::
::- - - Section Y - - - - GP Update - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
::

:REM Run gpupdate

::
::- - - Section Z - - - - REBOOT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
::


echo run 3rd reboot shutdown command
timeout /T 30
shutdown /r /t 90 /d p:0:11 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

timeout /T 10

 

Link to comment
Share on other sites

Try usin

 

set Message="Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"shutdown /r /t 90 /d p:0:11 /c %Message%

post-11313-0-75887700-1382098229_thumb.j

I don't get it... everything looks correct yet is still doesn't work properly... such a simple item yet so darn frustrating

Link to comment
Share on other sites

I forgot to say but the reason I suggest this, but it is because /d uses colons ":" and CMD/BAT files use these to mark sections where you can jump to

 

goto section2:section1cmd /bla:section2cmd /bla /bla
This may be why it works when you paste it in the cmd but not with your script
Link to comment
Share on other sites

shutdown /r /t 90 /d p:0:11 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

The "/d p:0:11" parameter is not valid.  Major:0, Minor:11 doesn't match anything in the below table.  Just skip it.

Microsoft Windows [Version 6.1.7601]

Copyright © 2009 Microsoft Corporation.  All rights reserved.
 
C:\Users\Blah>shutdown /?
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
 
    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /r         Shutdown and restart the computer.
    /g         Shutdown and restart the computer. After the system is
               rebooted, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /e         Document the reason for an unexpected shutdown of a computer.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).
 
 
Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type    Major   Minor   Title
 
 U      0       0       Other (Unplanned)
E       0       0       Other (Unplanned)
E P     0       0       Other (Planned)
 U      0       5       Other Failure: System Unresponsive
E       1       1       Hardware: Maintenance (Unplanned)
E P     1       1       Hardware: Maintenance (Planned)
E       1       2       Hardware: Installation (Unplanned)
E P     1       2       Hardware: Installation (Planned)
E       2       2       Operating System: Recovery (Planned)
E P     2       2       Operating System: Recovery (Planned)
  P     2       3       Operating System: Upgrade (Planned)
E       2       4       Operating System: Reconfiguration (Unplanned)
E P     2       4       Operating System: Reconfiguration (Planned)
  P     2       16      Operating System: Service pack (Planned)
        2       17      Operating System: Hot fix (Unplanned)
  P     2       17      Operating System: Hot fix (Planned)
        2       18      Operating System: Security fix (Unplanned)
  P     2       18      Operating System: Security fix (Planned)
E       4       1       Application: Maintenance (Unplanned)
E P     4       1       Application: Maintenance (Planned)
E P     4       2       Application: Installation (Planned)
E       4       5       Application: Unresponsive
E       4       6       Application: Unstable
 U      5       15      System Failure: Stop error
 U      5       19      Security issue
E       5       19      Security issue
E P     5       19      Security issue
E       5       20      Loss of network connectivity (Unplanned)
 U      6       11      Power Failure: Cord Unplugged
 U      6       12      Power Failure: Environment
  P     7       0       Legacy API shutdown

Try this instead:
shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"
Link to comment
Share on other sites

Trying it right now

EDIT: Just completed and removing the /d items didn't work either

I forgot to say but the reason I suggest this, but it is because /d uses colons ":" and CMD/BAT files use these to mark sections where you can jump to
 

goto section2:section1cmd /bla:section2cmd /bla /bla
This may be why it works when you paste it in the cmd but not with your script

 

Edited by compstuff
Link to comment
Share on other sites

That's exactly the string I tried in my last test and that also failed... I had added all the T commands so I could have time to see what was happening but it didn't help. Now I am commenting out 1 by 1 some of the other items in the bat to see if something else is causing this. Thanks for the help 

 

PS- I have been working on this so long that I can't remember where I got the p:0:11 from... probably a thread I read somewhere but thanks for the clarification.

 

shutdown /r /t 90 /d p:0:11 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

The "/d p:0:11" parameter is not valid.  Major:0, Minor:11 doesn't match anything in the below table.  Just skip it.

Microsoft Windows [Version 6.1.7601]

Copyright © 2009 Microsoft Corporation.  All rights reserved.
 
C:\Users\Blah>shutdown /?
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
 
    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /r         Shutdown and restart the computer.
    /g         Shutdown and restart the computer. After the system is
               rebooted, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /e         Document the reason for an unexpected shutdown of a computer.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).
 
 
Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type    Major   Minor   Title
 
 U      0       0       Other (Unplanned)
E       0       0       Other (Unplanned)
E P     0       0       Other (Planned)
 U      0       5       Other Failure: System Unresponsive
E       1       1       Hardware: Maintenance (Unplanned)
E P     1       1       Hardware: Maintenance (Planned)
E       1       2       Hardware: Installation (Unplanned)
E P     1       2       Hardware: Installation (Planned)
E       2       2       Operating System: Recovery (Planned)
E P     2       2       Operating System: Recovery (Planned)
  P     2       3       Operating System: Upgrade (Planned)
E       2       4       Operating System: Reconfiguration (Unplanned)
E P     2       4       Operating System: Reconfiguration (Planned)
  P     2       16      Operating System: Service pack (Planned)
        2       17      Operating System: Hot fix (Unplanned)
  P     2       17      Operating System: Hot fix (Planned)
        2       18      Operating System: Security fix (Unplanned)
  P     2       18      Operating System: Security fix (Planned)
E       4       1       Application: Maintenance (Unplanned)
E P     4       1       Application: Maintenance (Planned)
E P     4       2       Application: Installation (Planned)
E       4       5       Application: Unresponsive
E       4       6       Application: Unstable
 U      5       15      System Failure: Stop error
 U      5       19      Security issue
E       5       19      Security issue
E P     5       19      Security issue
E       5       20      Loss of network connectivity (Unplanned)
 U      6       11      Power Failure: Cord Unplugged
 U      6       12      Power Failure: Environment
  P     7       0       Legacy API shutdown

Try this instead:
shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

 

Edited by compstuff
Link to comment
Share on other sites

The "planned/unplanned" reasons were there only for server OS since they will halt the shutdown/restart to ask for a reason.  Consumer OS types don't ask.

More info: http://technet.microsoft.com/en-us/library/cc732503.aspx

 

I remember having a problem with shutdown before.

This will open a new command window and run the 'shutdown' line from there.  It'll also allow the first window to close gracefully while the shutdown is in progress.

Try this instead:

start "" /min /separate %comspec% /c shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

Link to comment
Share on other sites

Thanks I will try that today... very much appreciate the advice

 

 

The "planned/unplanned" reasons were there only for server OS since they will halt the shutdown/restart to ask for a reason.  Consumer OS types don't ask.

More info: http://technet.microsoft.com/en-us/library/cc732503.aspx

 

I remember having a problem with shutdown before.

This will open a new command window and run the 'shutdown' line from there.  It'll also allow the first window to close gracefully while the shutdown is in progress.

Try this instead:

start "" /min /separate %comspec% /c shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

Link to comment
Share on other sites

I ran an initial test and the same 1 minute message happened.. I will run a new test today to make sure I didn't make a mistake

 

Thanks I will try that today... very much appreciate the advice

 

 

The "planned/unplanned" reasons were there only for server OS since they will halt the shutdown/restart to ask for a reason.  Consumer OS types don't ask.

More info: http://technet.microsoft.com/en-us/library/cc732503.aspx

 

I remember having a problem with shutdown before.

This will open a new command window and run the 'shutdown' line from there.  It'll also allow the first window to close gracefully while the shutdown is in progress.

Try this instead:

start "" /min /separate %comspec% /c shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

 

Link to comment
Share on other sites

Well I ran it again and sure enough it gives the same 1 minute message

 

I ran an initial test and the same 1 minute message happened.. I will run a new test today to make sure I didn't make a mistake

 

Thanks I will try that today... very much appreciate the advice

 

 

The "planned/unplanned" reasons were there only for server OS since they will halt the shutdown/restart to ask for a reason.  Consumer OS types don't ask.

More info: http://technet.microsoft.com/en-us/library/cc732503.aspx

 

I remember having a problem with shutdown before.

This will open a new command window and run the 'shutdown' line from there.  It'll also allow the first window to close gracefully while the shutdown is in progress.

Try this instead:

start "" /min /separate %comspec% /c shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

 

 

Link to comment
Share on other sites

I am not a genius on the steps you are trying to accomplish, however can you tell when your batch file is running?  By that, I mean at what stage of your install.  It may be that the standard "shutdown" message occurs because your batch file is an "admin" mode while the rest of the desktop is in a "user" mode.  When an admin logs into someones computer remotely to shut it down, that screen usually pops up.  So maybe this is an odd mode interaction.

Link to comment
Share on other sites

To test it, I logged in as a normal user and opened a cmd window as admin and pasted the following. 

start "" /min /separate %comspec% /c shutdown /r /t 90 /c "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"

As expected I got the warning message "Finished Phase1..." and the system rebooted on its own 90 seconds later.

 

Can you get a screenshot of the message? (pause VM, screenshot).

Link to comment
Share on other sites

@Crashfly

I actually think it has something to do with the timing of when this is run because I run the same basic cmd 6 additional times later in my install process and it runs fine. I will define my process later when I return from work.

 

@Mr_Smartepants

That's whats confuses me about this, I can run or call that same exact string, after an install is complete, and it always runs fine. I even use the same basic string throughout other steps in the install and they run fine. I am sure their is a logical reason for this but I simply can't figure it out... I will define this all better after work which may help shed some light.

 

Since I am getting close to giving up on this and finding an alternative, I ran a test last night by adding poweroff http://users.telenet.be/jbosman/poweroff/poweroff.htm to my system32 folder via my $OEM$ folder and running the following string in my finish cmd:

 

echo run 3rd reboot shutdown command
timeout /T 10
start poweroff.exe reboot -warn -warntime 90 -msg "Finished Phase 1, base install, the system will reboot in 90 seconds and start Phase 2 - RunOnce WU_Satisfy"
 
That did work but I am still testing
Link to comment
Share on other sites

Sorry for the delay work has been overwhelming... anyway here is the explanation of what I do in my integration:

 

Overview:

Basically what I do is use simple scripts and reg files to add multiple reboots and processes via RunOnce. The way I do it is by running a script that runs a process, then adds and RunOnce entry for the next process and ends the current running script by rebooting the system. So in other words my process looks like this:

 

Use the finish command, which I have been having the problem with, to start the entire process and from (Section 8) add a  RunOnce that after reboot calls a version of McRip's script to add WU_Satisfy hotfixes and then add the next RunOnce and then reboot.

 

Upon the reboot a modified KUC script is run that only deletes the old IE8 items as defined by KUC, it then adds the next RunOnce and does a reboot.

Upon the reboot a modified KUC script is run to remove the OLD items as defined by that months KUC testing, it then adds the next RunOnce and does a reboot

Upon the reboot I run the same as the previous step removing items that needed a second pass, it then adds the next RunOnce and does a reboot

Upon the reboot I run a modified KUC script to update the image as defined by that months KUC testing, it then adds the next RunOnce and does a reboot

Upon the reboot I run a Office install with a transform and reboot.

This completes my install

 

1) WU_Satisfy 3rd reboot Phase 2
2) Remove_OLD-IE 4th reboot Phase 3
3) Remove_OLD 5th reboot Phase 4
4) Remove_OLD_Pass2 6th reboot Phase 5
5) RunOnce_WU_Update 7th reboot Phase 6
6) office_install 8th reboot Phase 7
 
Questions, advice, assistance,,, I am open to it all and I hope this helps better understand the process and possibly the resolution to this. The problem only happens in the first shutdown of the finish.cmd... the other calls all work fine and so far the poweroff solution I have tried twice and it seems to work
Edited by compstuff
Link to comment
Share on other sites

That a very valid question... I always do an integration using WinToolKit and McRip's latest repo and I do the additional items as well based on need. Yet I have never ever been able to run the KUC after and have them agree, I always come up with lots of removes and updates. So based on that I attempt to create a know working image based on a period of time when everything seems to coincide including Windows Update.

 

The integration I am working on now will actually be a slightly modified update that is from just before the last MS Tuesday release. Currently it all works with just a few exceptions. I will use that image for about 2 months and the create a new updated image in the same manner (I am already working on the new one) I can also do some simple updates to that image as we deploy it eg. frequently Java, flash, runtimes all update or your DOTNET, so I just add the new files to the iso WinToolkit_Apps folder and that makes a very easy update to the image. In concept its like minor and major updates to my images.

 

Do you have suggestion from streamlining my process?

Why not integrate, then all you need to do is remove old and office

Edited by compstuff
Link to comment
Share on other sites

Then use KUC to scan your mounted image, this will give you the updates you need and it will skip any updates that are not able to be integrated offline, you can even pick which components you want to update (its much smarter)

Just run with /DVD-Image-dir:X:\path for mounted WIM or /VHD-drive:X:\path for mounted VHD

After, you can use the same CMD's created to integrate or remove OLD (IE8 removal can only be done offline, KUC knows this and will tell you in your packages out)

Link to comment
Share on other sites

Trying to absorb what you described since its new to me... so if I understand your general idea... do my normal integration leaving out some of my RunOnce scripting and run the KUC to update the image. Then run the cleanup scripts and I get the same end result. Is that correct?

Then use KUC to scan your mounted image, this will give you the updates you need and it will skip any updates that are not able to be integrated offline, you can even pick which components you want to update (its much smarter)

Just run with /DVD-Image-dir:X:\path for mounted WIM or /VHD-drive:X:\path for mounted VHD

After, you can use the same CMD's created to integrate or remove OLD (IE8 removal can only be done offline, KUC knows this and will tell you in your packages out)

Link to comment
Share on other sites

- Mount your wim image with dism
- Run KUC with params (listed above changing X:\path) poining to your mounted folder
- Use it the same way you use it to scan a online install
- Let KUC create packages.txt, scan it, download and create the necesary scripts
- Use cmd scripts to copy, remove and/or add updates into the mounted image (/online will change to /image:<your_path> so when you execute them, the updates will be integrated vs installed on your current pc)

Its the same as scanning your current image, only its scanning the mounted wim/vhd, more info in the FAQ

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...