/usr/lib/rds/launchapp.vbs is in rdsserver 1.1.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 'launchapp.vbs, modified from Microsoft's launchapp.wsf
'launches a process as interactive user, NOT as the elevated privilege user context
Option Explicit
Const TriggerTypeRegistration = 7
Const ActionTypeExecutable = 0
Const FlagTaskCreate = 2
Const LogonTypeInteractive = 3
Dim strWorkingDirectory, strHostname, strOSVer, colProcessList, strUser, strDomain
Dim objNetwork, objComputer, objShell, objExec, objWMI, objItem, strScriptName, strStdOut
strWorkingDirectory = "%%SCRIPT_PATH%%"
'launch this login script
strScriptName = "drivemap-%%HOSTNAME%%.vbs"
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
strHostname = objNetwork.ComputerName
Set objComputer = GetObject("WinNT://" & strHostname & ",computer")
strOSVer = objComputer.OperatingSystemVersion
If strOSVer >= "6.0" Then
If IsElevated() Then
'Machine has UAC and user is elevated so use LAUNCHAPP.WSF Task Scheduler method based
'on appendix from http://technet.microsoft.com/en-us/library/cc766208(WS.10).aspx
LaunchApp
Else
'User is not elevated, so launch the script normally
objShell.Run "wscript.exe //nologo " & Chr(34) & strWorkingDirectory & "\" & strScriptName & Chr(34), 1
End If
Else
'This is a Windows XP/2003 machine, so launch the script normally
objShell.Run "wscript.exe //nologo " & Chr(34) & strWorkingDirectory & "\" & strScriptName & Chr(34), 1
End If
Set objNetwork = nothing
Set objComputer = nothing
Set objShell = nothing
Function IsElevated()
IsElevated = False
strStdOut = ""
Set objExec = objShell.Exec ("whoami /groups")
Do While (objExec.Status = 0)
WScript.Sleep 100
If Not objExec.StdOut.AtEndOfStream Then
strStdOut = strStdOut & objExec.StdOut.ReadAll
End If
Loop
If InStr(strStdOut,"S-1-16-12288") Then
IsElevated = True
End If
Set objExec = nothing
End Function
Sub LaunchApp
Dim objTaskService
Dim strTaskName, rootFolder, taskDefinition, triggers, trigger, Action
'Create the TaskService object
Set objTaskService = CreateObject("Schedule.Service")
Call objTaskService.Connect()
strTaskName = "Launch App As Interactive User"
'Get a folder to create a task definition in
Set rootFolder = objTaskService.GetFolder("\")
'Delete the task if already present
On Error Resume Next
Call rootFolder.DeleteTask(strTaskName, 0)
Err.Clear
'Create the new task
Set taskDefinition = objTaskService.NewTask(0)
'Create a registration trigger
Set triggers = taskDefinition.Triggers
Set trigger = triggers.Create(TriggerTypeRegistration)
'Create the action for the task to execute
Set Action = taskDefinition.Actions.Create(ActionTypeExecutable)
Action.Path = "wscript.exe"
Action.Arguments = "//nologo " & strScriptName
Action.WorkingDirectory = strWorkingDirectory
'Register (create) the task
call rootFolder.RegisterTaskDefinition(strTaskName, taskDefinition, FlagTaskCreate,,, LogonTypeInteractive)
Set objTaskService = nothing
End Sub
|