This project is read-only.

Running installation with user interaction while connected using RDP

Topics: Archive - General
Jan 21, 2015 at 6:05 PM
Hi,

I'm testing the toolkit with SCCM using ServiceUI and I found out that the user interface displays with no issues if the user is physically connected to the machine but nothing is shown if the user is connected using RDP.

The installation log shows the following:
The following users are logged on to the system: DOMAIN\user
Current process is running under a system account [NT AUTHORITY\SYSTEM]
There is no console user logged in (user with control of physical monitor, keyboard, and mouse).
...
Session 0 detected, process running in user interactive mode, user(s) logged in.

What could be the reason for not having a user interface while connected using RDP?

Log file:
[Initialization] :: *******************************************************************************     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: *******************************************************************************     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: [.NET.Framework.4.5.2.Multi-Targeting.Pack_4.5.51651_001] setup started.        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Script [C:\Windows\ccmcache\4\AppDeployToolkit\AppDeployToolkitMain.ps1] dot-source invoked by [C:\Windows\ccmcache\4\Deploy-Application.ps1]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Script [C:\Windows\ccmcache\4\AppDeployToolkit\AppDeployToolkitExtensions.ps1] dot-source invoked by [C:\Windows\ccmcache\4\AppDeployToolkit\AppDeployToolkitMain.ps1]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: [.NET.Framework.4.5.2.Multi-Targeting.Pack_4.5.51651_001] script version is [1.0.0]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: [Deploy Application] script version is [3.6.0]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: [App Deploy Toolkit Main] script version is [3.6.0]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: [App Deploy Toolkit Extensions] version is [1.5.0]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Computer Name is [YY.DOMAIN]        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Current User is [NT AUTHORITY\SYSTEM]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: OS Version is [Microsoft Windows 7 Enterprise Service Pack 1 64-bit 6.1.7601.65536]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: OS Type is [Workstation]        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Current Culture is [en-US] and UI language is [EN]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Hardware Platform is [Virtual:VMWare]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: PowerShell Host is [ConsoleHost] with version [2.0]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: PowerShell Version is [2.0 x64]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: PowerShell CLR (.NET) version is [2.0.50727.5477]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: *******************************************************************************     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get session information for all logged on users.        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Logged on user session details: 


NTAccount          : DOMAIN\user
UserName           : user
DomainName         : DOMAIN
SessionId          : 1
SessionName        : RDP-Tcp#0
ConnectState       : Active
IsCurrentSession   : False
IsConsoleSession   : False
IsUserSession      : True
IsLocalAdmin       : False
LogonTime          : 1/5/2015 4:02:17 PM
IdleTime           : 00:00:26.0656063
DisconnectTime     : 1/21/2015 11:11:11 AM
ClientName         : ZZ
ClientProtocolType : RDP
ClientDirectory    : C:\windows\system32\mstscax.dll
ClientBuildNumber  : 7601



        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: The following users are logged on to the system: DOMAIN\user        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Current process is running under a system account [NT AUTHORITY\SYSTEM]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: There is no console user logged in (user with control of physical monitor, keyboard, and mouse).        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: The process is running in a terminal server session: [False].       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Unable to load COM Object [Microsoft.SMS.TSEnvironment]. Therefore, script is not currently running from a SCCM Task Sequence.      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [EventSystem] exists        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service [EventSystem] startup mode.     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [EventSystem] startup mode is set to [Automatic]        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service object for service [EventSystem]        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [EventSystem] with display name [COM+ Event System] has a status of [Running]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [RpcSs] exists      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service [RpcSs] startup mode.       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [RpcSs] startup mode is set to [Automatic]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service object for service [RpcSs]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [RpcSs] with display name [Remote Procedure Call (RPC)] has a status of [Running]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [EventLog] exists       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service [EventLog] startup mode.        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [EventLog] startup mode is set to [Automatic]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service object for service [EventLog]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [EventLog] with display name [Windows Event Log] has a status of [Running]      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [Schedule] exists       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service [Schedule] startup mode.        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [Schedule] startup mode is set to [Automatic]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Get the service object for service [Schedule]       1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Service [Schedule] with display name [Task Scheduler] has a status of [Running]     1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: The task scheduler service is in a healthy state: True      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Session 0 detected, process running in user interactive mode, user(s) logged in.        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: System has a DPI scale of [100].        1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Installation is running in [Interactive] mode.      1/1/1601 12:00:00 AM    0 (0x0000)
[Initialization] :: Deployment type is [Installation]       1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Get deferral history...       1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Return fully qualified registry key path [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\XX\Packages\PSAppDeployToolkit\DeferHistory\.NET.Framework.4.5.2.Multi-Targeting.Pack_4.5.51651_001]      1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Registry key [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\XX\Packages\PSAppDeployToolkit\DeferHistory\.NET.Framework.4.5.2.Multi-Targeting.Pack_4.5.51651_001] does not exist       1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: User has [4] deferrals remaining.     1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Convert the date [01/24/2015 11:19:10] to a universal sortable date time pattern based on the current culture [en-US]     1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: User has until [2015-01-24 11:19:10Z] before deferral expires.        1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Convert the date [01/21/2015 11:19:10] to a universal sortable date time pattern based on the current culture [en-US]     1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Check for running application(s) [iexplore]...        1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: The following processes are running: [iexplore]       1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Resolve process descriptions...       1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Finished checking running application(s).     1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Prompt user to close application(s) [Internet Explorer]...        1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: User has the option to defer.     1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Close applications countdown has [3600] seconds remaining.        1/1/1601 12:00:00 AM    0 (0x0000)
[Pre-Installation] :: Close applications countdown has [3600] seconds remaining.        1/1/1601 12:00:00 AM    0 (0x0000)
Jan 22, 2015 at 9:44 AM
On terminal servers, there is a specific session (session 0 I think) reserved for a "console" connection to the terminal server. This is the session admins usually connect to if they need to check if some program has a prompt up which is causing some software to hang for example. So if you RDP into a PC, your session will never be the console session and Windows will never see it as the "active" user in control of the keyboard, mouse, monitor. ServiceUI only displays the the UI to the user that it determines is the console user. On terminal servers, I think you must log into the console session for ServiceUI to function properly. For users living in a VDI environment, ServiceUI would probably not work.
Jan 22, 2015 at 10:01 AM
Looking at this page here:
http://blogs.technet.com/b/cameronk/archive/2011/01/25/can-i-use-serviceui-exe-to-launch-other-programs-besides-the-udi-setup-wizard.aspx

It seems that you can force ServiceUI to display the UI in the same session that a process is currently running in.
Command line: ServiceUI.exe -process:tsprogressui.exe Wizard.exe

This means that you would need to choose a unique process name that is only running in that session.

So for VDI/RDP scenarios, you would have to somehow choose a user to display the progress messages to. If there is only one user logged in (as would be the case in VDI environments), then that is easy.
Jan 22, 2015 at 10:08 AM
Edited Jan 22, 2015 at 10:35 AM
Slight update... You don't even need to specify the name of a process. You can directly specify the session you want to display the UI in. The Get-LoggedOnUser function will return the session that the user is in via the SessionID property. You can use the value of this property like so to display the UI to that user:
ServiceUI.exe -session:1 someexewithui.exe

So you would basically have to relaunch the toolkit with the right "ServiceUI.exe -session:#" option at the point where you determine that there is no console user logged in but there is a user logged in.
Jan 22, 2015 at 3:38 PM
Edited Jan 22, 2015 at 3:39 PM
Thanks for looking at this @mmashwani!

In our scenario only one user will be logged on to the machines at any time.

How could I correctly detect the session in this case to pass the argument to ServiceUI? For instance in the toolkit log I see that the user session detected is 1 but while checking the session on the task manager I see that it is actually 2.

Btw, I have been using the approach suggested by @jlapchuk on another topic and it's been working fine to avoid the error 5 that we were facing before with ServiceUI:
Install: Install.bat
Uninstall: Uninstall.bat
Run installation and uninstall program as 32-bit process on 64-bit clients

Install for System
Whether or not a user is logged on
Normal

The command lines for each bat file:
Install: PSExec.exe -si -accepteula %cd%\ServiceUI.exe %cd%\Deploy-Application.exe
Uninstall: PSExec.exe -si -accepteula %cd%\ServiceUI.exe %cd%\Deploy-Application.exe Uninstall