3 Replies Latest reply on Aug 25, 2004 1:45 PM by Support_1

    Deploy while user is not logged on

    maincomp Apprentice
      I've been digging through the different user and machine contexts but can't seem to find where to set a package only to deploy when users are logged off.  I want to uninstall a keying application, but the user can't be logged in or the logging function is in use and won't let the app uninstall.
        • 1. Re: Deploy while user is not logged on
          dcolburn Rookie
          Well, have you tried working it through your extremely intelligent co-worker?
          • 2. Re: Deploy while user is not logged on
            maincomp Apprentice
            Sorry if that scared you away from answering, but I still haven't received any thoughts if anyone has some suggestions.
            • 3. Re: Deploy while user is not logged on
              Support_1 Specialist
              You can get the username of the last logged in user from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName then check if ntuser.dat for that userprofile is currently in use. If it is in use then a user is logged into the machine. If it is not in use then no user is logged into the machine.

              here's a copy of the script.inc we have used in the past on NT machine to determine if a reboot should occur. It first checks if a user is currently logged in.
              !- Set the userloggedon variable to 'no'
              Set('userloggedon','no')
              !
              !- Get the username of the last user to log onto the machine
              RegReadValue('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon','DefaultUserName','lastusr')
              !
              !- Check for the existence of the last user's NTUSER.DAT
              !- If it is not there then no user is logged on and the profile has been deleted (per policy setting)
              If Exist('%windir%\profiles\%lastusr%
              tuser.dat')
              !
              ! - If the profile existst but NTUSER.DAT is not in use then the user is not logged in
              If IsFileInUse('%windir%\profiles\%lastusr%
              tuser.dat')

              !  - The profile exists and NTUSER.DAT is in user. This means a user is logged in
                Set('userloggedon','yes')
              !
              !- This var is originally set to 'no' and then changed to 'yes' only if a user is logged on
              If %userloggedon%='yes'
              !
              ! - Determine if the logged on user would like to reboot
              MsgBoxEx('Do you want to reboot?','reboot','',mbYesNo)
              If %reboot%='No'

              !  - If the user doesn't want to reboot then then clear any reboot flag and record the project as installed
                ClearRestartFlags
                ExitProc(Done)

              !- In the event that no user is logged on or the user clicked 'Yes' to reboot the machine will now reboot
              InitiateSystemShutDown('0',issRebootAfterShutdown)

              EndProc