Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. making the computer restart after a setup program is finished

making the computer restart after a setup program is finished

Scheduled Pinned Locked Moved C#
questionworkspace
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blakeb_1
    wrote on last edited by
    #1

    Hello, What would be the best way to go about making a computer restart after my setup program has finished running? I can't seem to find anything built-in to the setup program. Will I need to specify a custom action to do this? Thanks, Blake

    H T 2 Replies Last reply
    0
    • B blakeb_1

      Hello, What would be the best way to go about making a computer restart after my setup program has finished running? I can't seem to find anything built-in to the setup program. Will I need to specify a custom action to do this? Thanks, Blake

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      If you're using Windows Installer, it decides if a reboot is necessary. If - for some odd reason - you need to reboot regardless of what Windows Installer thinks, create a REBOOT property in the Properties table and set it to Force. If you're using VS.NET's installer project, you'll have to download the Windows Installer SDK on the Platform SDK web site, install Orca (copied to your machine as Orca.msi in the PSDK's bin directory), open your compiled MSI, and add the property to the Properties table manually. If you need to conditionally set it, you can use a CustomAction that sets the REBOOT property to Force. Note the case of the REBOOT property, though - it must be all uppercase. You could also write a custom action DLL, but it isn't necessary since - as you can see - you can have Windows Installer do it.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      B 1 Reply Last reply
      0
      • H Heath Stewart

        If you're using Windows Installer, it decides if a reboot is necessary. If - for some odd reason - you need to reboot regardless of what Windows Installer thinks, create a REBOOT property in the Properties table and set it to Force. If you're using VS.NET's installer project, you'll have to download the Windows Installer SDK on the Platform SDK web site, install Orca (copied to your machine as Orca.msi in the PSDK's bin directory), open your compiled MSI, and add the property to the Properties table manually. If you need to conditionally set it, you can use a CustomAction that sets the REBOOT property to Force. Note the case of the REBOOT property, though - it must be all uppercase. You could also write a custom action DLL, but it isn't necessary since - as you can see - you can have Windows Installer do it.

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        B Offline
        B Offline
        blakeb_1
        wrote on last edited by
        #3

        Thanks for the info. If I am using the bootstrapper sample form Microsoft's website to do a silent installation of .Net framework, will Windows Installer take the .net framework installation into account when determining if the reboot is necessary? And, I am using MDAC and Jet merge modules in the setup program also. Will it take these into account? Thanks for the reply! Blake

        H 1 Reply Last reply
        0
        • B blakeb_1

          Thanks for the info. If I am using the bootstrapper sample form Microsoft's website to do a silent installation of .Net framework, will Windows Installer take the .net framework installation into account when determining if the reboot is necessary? And, I am using MDAC and Jet merge modules in the setup program also. Will it take these into account? Thanks for the reply! Blake

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          The bootstrapper runs before the Windows Installer package, so Windows Installer won't know. I'm not aware of how the bootstrapper could tell the installer to reboot, since the bootstrapper typically only knows about the Database object (where the properties are read-only). Perhaps the bootstrapper can get the Instance after invoking MSI on the package, but you'd have to read the Windows Installer SDK. I've never had to attempt modifying the installer from the boostrapper to know. In most cases, though, you want the bootstrapper to reboot before restarting the Windows Installer package. If the .NET Framework installation isn't finalized when your MSI package begins, you may run into problems. While rare, I have had problems where - after installing SP2 - the GAC wasn't setup completely and trying to install assemblies into a GAC that didn't exists screwed some things up. It wasn't disasterous, but your average stupid user using your product might not like it. As far as Jet and MDAC go (they are merge modules), if Windows Installer determines that files they needed to replace are in use or that the machine needs to reboot (which is stupid in most cases for NT-based Windows OSes because the user need only logout and back on), it will do so either when necessary or at the end, depending on what you set the REBOOT property to. Valid values are Force, Surpress, and ReallySurpress. See the Windows Installer SDK for more information.

          -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

          A 1 Reply Last reply
          0
          • H Heath Stewart

            The bootstrapper runs before the Windows Installer package, so Windows Installer won't know. I'm not aware of how the bootstrapper could tell the installer to reboot, since the bootstrapper typically only knows about the Database object (where the properties are read-only). Perhaps the bootstrapper can get the Instance after invoking MSI on the package, but you'd have to read the Windows Installer SDK. I've never had to attempt modifying the installer from the boostrapper to know. In most cases, though, you want the bootstrapper to reboot before restarting the Windows Installer package. If the .NET Framework installation isn't finalized when your MSI package begins, you may run into problems. While rare, I have had problems where - after installing SP2 - the GAC wasn't setup completely and trying to install assemblies into a GAC that didn't exists screwed some things up. It wasn't disasterous, but your average stupid user using your product might not like it. As far as Jet and MDAC go (they are merge modules), if Windows Installer determines that files they needed to replace are in use or that the machine needs to reboot (which is stupid in most cases for NT-based Windows OSes because the user need only logout and back on), it will do so either when necessary or at the end, depending on what you set the REBOOT property to. Valid values are Force, Surpress, and ReallySurpress. See the Windows Installer SDK for more information.

            -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

            A Offline
            A Offline
            AndrewCherry
            wrote on last edited by
            #5

            Just one comment not on the technical side. If you don't wish to royally piss off most of your users, don't force a reboot at all, unless it is extremely neccesary. Several programs i've used lately have popped up a box at the end simply saying "Click OK to reboot". This is rarely neccesary, and certainly wasn't in some instances. This is amazingly bad usability design, and is hugely presumptious. Try to avoid this! Just a comment :)

            H 1 Reply Last reply
            0
            • B blakeb_1

              Hello, What would be the best way to go about making a computer restart after my setup program has finished running? I can't seem to find anything built-in to the setup program. Will I need to specify a custom action to do this? Thanks, Blake

              T Offline
              T Offline
              Terrence Benade
              wrote on last edited by
              #6

              Please give it some thought about forcing a clients machine to reboot. Just think how irritating it is when an application reboots your machine. Personaly believe the best option is to place messages in the installer to say a reboot is necessary, and leave it up to the end-user. My one cent.

              1 Reply Last reply
              0
              • A AndrewCherry

                Just one comment not on the technical side. If you don't wish to royally piss off most of your users, don't force a reboot at all, unless it is extremely neccesary. Several programs i've used lately have popped up a box at the end simply saying "Click OK to reboot". This is rarely neccesary, and certainly wasn't in some instances. This is amazingly bad usability design, and is hugely presumptious. Try to avoid this! Just a comment :)

                H Offline
                H Offline
                Heath Stewart
                wrote on last edited by
                #7

                This is a moot point with Windows Installer. Setting REBOOT to Force still prompts the user with a Yes/No dialog. Your comment is most definitely valid in a custom installer, but that's not the case here.

                -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups