Executing [C:\WINDOWS\system32\shutdown.exe /l] – breaking script

//Executing [C:\WINDOWS\system32\shutdown.exe /l] – breaking script
Executing [C:\WINDOWS\system32\shutdown.exe /l] – breaking script 2017-02-27T09:58:35+00:00

The Toolkit Forums General Executing [C:\WINDOWS\system32\shutdown.exe /l] – breaking script

  • Author
    Posts
  • Long
    Participant
    Post count: 14
    #1971 |

    I want to logoff the user is there is a user logged on and then install my stuff.

    But seem that the script break because of this.

    The Settings in SCCM is
    Install for system
    Only when a user is logged on

    Here the log,..seem is just died..

    The installation should run in system context ? so it should not died when user get log off?

    Or should i change the interactive to silent?

    .\Deploy-Application.exe -DeploymentType “Install” -DeployMode “Interactive”

    <code>[Pre-Installation] :: [shutdown] successfully resolved to fully qualified path [C:\WINDOWS\system32\shutdown.exe].	Execute-Process	27-02-2017 10:46:48	4400 (0x1130)
    [Pre-Installation] :: Working Directory is [C:\WINDOWS\system32].	Execute-Process	27-02-2017 10:46:48	4400 (0x1130)
    [Pre-Installation] :: Executing [C:\WINDOWS\system32\shutdown.exe /l]...	Execute-Process	27-02-2017 10:46:48	4400 (0x1130)
    [Pre-Installation] :: Execution completed successfully with exit code [0].	Execute-Process	27-02-2017 10:46:48	4400 (0x1130)
    [Pre-Installation] :: Get information for installed Product Code [{BE40B3E0-129E-313C-B663-94C192C5143F}]...	Get-InstalledApplication	27-02-2017 10:46:48	4400 (0x1130)
    [Pre-Installation] :: Get information for installed Product Code [{BE40B3E0-129E-313C-B663-94C192C5143F}]...	Get-InstalledApplication	27-02-2017 10:46:49	4400 (0x1130)
    [Installation] :: xStatus - Installation tasks	xStatus	27-02-2017 10:46:49	4400 (0x1130)
    [Installation] :: Get information for installed Product Code [{BE40B3E0-129E-313C-B663-94C192C5143F}]...	Get-InstalledApplication	27-02-2017 10:46:49	4400 (0x1130)
    [Installation] :: xStatus - Install - Begin: Google, Inc. Google Chrome 	xStatus	27-02-2017 10:46:49	4400 (0x1130)
    [Installation] :: [msiexec] successfully resolved to fully qualified path [C:\WINDOWS\system32\msiexec.exe].	Execute-Process	27-02-2017 10:46:49	4400 (0x1130)
    [Installation] :: Check to see if mutex [Global\_MSIExecute] is available. Wait up to [10 minute(s)] for the mutex to become available.	Test-IsMutexAvailable	27-02-2017 10:46:49	4400 (0x1130)
    [Installation] :: Mutex [Global\_MSIExecute] is available for an exclusive lock.	Test-IsMutexAvailable	27-02-2017 10:46:49	4400 (0x1130)
    </code>

    anyone know a workaround for doing this?

    • This topic was modified 9 months ago by  Long.
  • Francois
    Participant
    Post count: 101

    Hi,

    Your log is not showing very much info.
    Why running when a user is logged on? With PSADTK, you can detect if someone is logged on or not. May be you should get a look to Windows installer log.

    Is it an app or a package? Are you running it with elevated privil├Ęges?

    Thanks,

  • Long
    Participant
    Post count: 14

    The usage i need is this:

    We have some lockdown workstation for some informations board. With Autologin. So there will always be someone logged in.

    I need to close some app down before installing the update. All this unattended with no user input.
    That why i run the shutdown /l to log off the currently logged in user and then run the script.

    The content is executed with the system account and with elevated privil├Ęges. Somehow the “shutdown /l” cut off the script.

    Using SCCM2012R2 for the deployment.

    • This reply was modified 8 months, 4 weeks ago by  Long.
  • Justin
    Participant
    Post count: 13

    You could run the following:

    Execute-ProcessAsUser -Path 'C:\Windows\System32\logoff.exe' -RunLevel LeastPrivilege

    or a little more flexible

    Execute-ProcessAsUser -Path "$($envWinDir)\System32\logoff.exe" -RunLevel LeastPrivilege

    This will run the process as the logged on user and simply log off.

  • Long
    Participant
    Post count: 14

    I will give above method a try.

    another think…when the user is logged of and the installation done…

    can i then use:

    Show-InstallationRestartPrompt -Countdownseconds 10

    or should i use “Restart-Computer”

    • This reply was modified 8 months, 4 weeks ago by  Long.
  • Jim
    Participant
    Post count: 45

    Why not just use the Show-InstallationWelcome function?

    Show-InstallationWelcome -CloseApps 'iexplore' -Silent -BlockExecution

    Just be careful with the blockexecution switch. If the script bombs out for any reason, the user won’t be able to launch the apps until the script is re-run and completes successfully.

    • Long
      Participant
      Post count: 14

      the Show-InstallationWelcome

      does not reboot the mashine or?? when nobody is logged on?

    • Jim
      Participant
      Post count: 45

      Not sure what you are asking. Thought you said they were autologous. Thought you just needed to close some open apps.

  • Long
    Participant
    Post count: 14

    …I did some checks.

    Have two type of mashine….the autologons and the normal where there is a real user logged on.

    On the normal we will prompt the user to accept the update.

    On the autologon we force shutdown the app and update. Reboot so it start correct up again after the update.

    Got with working with above input.

    Preinstall: Execute-ProcessAsUser -Path “$($envWinDir)\System32\logoff.exe” -RunLevel LeastPrivilege

    post install : Show-InstallationRestartPrompt -Countdownseconds 10

  • Long
    Participant
    Post count: 14

    …I did some checks.

    Have two type of mashine….the autologons and the normal where there is a real user logged on.

    On the normal we will prompt the user to accept the update.

    On the autologon we force shutdown the app and update. Reboot so it start correct up again after the update.

    Got with working with above input.

    Preinstall: Execute-ProcessAsUser -Path “$($envWinDir)\System32\logoff.exe” -RunLevel LeastPrivilege

    post install : Show-InstallationRestartPrompt -Countdownseconds 10

You must be logged in to reply to this topic.