script that can detect the session id and use psexec

Topics: Archive - General
Feb 18, 2015 at 3:00 PM
Hi, is there a script that can detect the session id of the user and kick off the powershell script using psexec? I would like to use a scheduled task to deploy java and pass along the UI to the end user if they are logged in. Thanks for any help in advance.
Feb 28, 2015 at 3:04 AM
Did you tried serviceui.exe?
Mar 2, 2015 at 3:41 PM
Hi, I have and cannot get it to work consistantly. Does anyone have an example on how they use it successfully?
Mar 4, 2015 at 1:17 PM
I am able to get this working with below command.

ServiceUi.exe Deploy-Application.exe

Did you try checking the option "Run programs as 32bit on 64bit machine"?

Regards
WaiYin
Mar 9, 2015 at 3:30 PM
superz202 wrote:
I am able to get this working with below command.

ServiceUi.exe Deploy-Application.exe

Did you try checking the option "Run programs as 32bit on 64bit machine"?

Regards
WaiYin
Is this a setting with SCCM? I'm not using SCCM. I'm using a cmd file via a task to kick off everything.
Thanks
Mar 9, 2015 at 6:47 PM
PSADT does detect the Session ID

[Initialization] :: Logged on user session details: 


#NTAccount          : DomainName\MyUserName
UserName           : MyUserName
DomainName         : DomainName
SessionId          : 2
SessionName        : RDP-Tcp#0
ConnectState       : Active
IsCurrentSession   : True
IsConsoleSession   : False
IsUserSession      : True
LogonTime          : 05/03/2015 4:50:43 PM
IdleTime           : 00:00:07.9096563
DisconnectTime     : 
ClientName         : MyComputerName
ClientProtocolType : RDP
ClientDirectory    : C:\Windows\system32\mstscax.dll
ClientBuildNumber  : 9600
Here you see my SessionId = 2

It's done via the Get-LoggedOnUser Function
Mar 10, 2015 at 1:13 PM
han891 wrote:
superz202 wrote:
I am able to get this working with below command.

ServiceUi.exe Deploy-Application.exe

Did you try checking the option "Run programs as 32bit on 64bit machine"?

Regards
WaiYin
Is this a setting with SCCM? I'm not using SCCM. I'm using a cmd file via a task to kick off everything.
Thanks
Yes, this is a setting found in SCCM.

Best regards
WaiYin