MartinR.
Posts: 5
Joined: Wed Oct 17, 2012 9:12 am

Force Reboot from VBS

Hi all,

I'm trying to schedule a reboot from within a VBS script I'm executing as part of my installation process. The user should be prompted to reboot the PC after the installation is done.
I'm doing

Code: Select all

Session.Property("MsiSystemRebootPending") = "1"
Session.Property("REBOOT") = "Force"
in the VBS script but it doesn't seem to have any effect. The installer project is set to "Prompt for Reboot if required"
I've put it in a very small sample project, the log file says that the change of the properties is being executed (see attachment). As you can see, the log file says
You must restart your system for the configuration changes made to Test to take effect. Click Yes to restart now or No if you plan to manually restart later.
but I'm never seeing this - so what am I doing wrong? Why do I have to set the Finish Dialog according to (http://www.advancedinstaller.com/user-g ... stall.html) with a checkbox that *again* sets the REBOOT property to FORCE ?

Cheers
Martin
Attachments
log.txt
(218.11 KiB) Downloaded 396 times
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Force Reboot from VBS

Hi Martin,

I tested your scenario and it worked well to me. After the installation is complete a message box prompts for restart (this is the normal behavior when the "REBOOT" property is set to "Force").

So, if you run the script you mentioned as a part of your installation, you don't need to follow the steps in the How do I restart the machine after the installation tutorial anymore because they do exactly the same thing. You only have to make sure that the "Prompt for Reboot if required" option is selected in the Install Parameters page.

Can you reproduce the behavior on multiple clean machines?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MartinR.
Posts: 5
Joined: Wed Oct 17, 2012 9:12 am

Re: Force Reboot from VBS

Hi Eusebiu,

thanks for your reply. I should have been more specific from the beginning:
The installer supports Win XP (32bit), 7(32/64bit), Server2008R2(64bit) and Server2012(64bit) . I'm trying (and succeeding) to install Desktop-Experience in Server2008, I don't have any Server2012 to test with. Desktop-Experience is installed via the VBS script, which checks the return value of the installation of Desktop-Experience. If that return value is set to 3010, the VBS script sets the above mentioned properties.
So I only have on system (actually a VM) to test with. I tried to run a temporary VBS custom action when pressing "Finish". That temp VBS file was supposed to MsgBox me the Value of Session.Property("REBOOT") but only gave an empty string.
If you want to, I can upload a sample AIP project next week ( I'm not in office this week) which shows this behaviour in Win Server 2008R2, 64bit. Seems to be the best approach since it's working for you :-)

Best regards

Martin
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Force Reboot from VBS

Hi Martin,

I attached here a sample that works on my computer and prompts for restart after the installation is finished.

Also, you can try to select the "Force Reboot after install" option from the Install Parameters page to see if the problem persists (you will no longer need to run the VBScript in this case).

Best regards,
Eusebiu
Attachments
reboot Prompt.rar
(2.55 KiB) Downloaded 502 times
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”