Hi!
I am trying to deploy an application with intune. The package is a PSAppDeployToolkit Package. In the package I am useing the set-activesetup function.
PSADT’s Set-ActiveSetup is designed to trigger the -StubExePath if a user is logged-in at install time.
Active Setup only triggers once and Set-ActiveSetup will check if Active Setup has already been triggered or not. That’s probably why you get an error when running deploy-application.exe manually.
Only PSAppDeployToolkit_v3.9.4 (PR) and PSAppDeployToolkit_v3.10.0 have RunHidden.vbs.
It’s part of the Execute-ProcessAsUser function. (it’s used to trigger the -StubExePath if a user is logged-in at install time as that user.)
RunHidden.vbs is a new file and its line 98(Thanks to your initial post) is:
Set oArgumentList = CreateObject("System.Collections.ArrayList")
While doing that “simple web search” I saw mentions of ArrayList and ignored them because I thought only PowerShell and C# could use them.
[The] solution was to install .NET 3.5 even though I had .NET 4.0 installed on my machine. You specifically need the 3.5 version to use System.Collections.ArrayList .
Thank you for clarifying that there is a dependency on .NET 3.5 here.
Based on that hint, I was able to fix this for me in RunHidden.vbs by replacing System.Collections.ArrayList with a native VBScript array, so that there is no need to install .NET 3.5.
Dim sCmd, oWShell, iReturn, arg, bCmdDetected, oArgumentList(), i
iReturn = 0
If WScript.Arguments.Count > 0 Then
' Check if first argument references cmd or cmd.exe'
bCmdDetected = IsCmdAtEnd(WScript.Arguments(0))
ReDim oArgumentList(WScript.Arguments.Count)
For i=0 To WScript.Arguments.Count-1
oArgumentList(i) = ArgvQuote(WScript.Arguments(i), False, bCmdDetected)
Next
sCmd = Join(oArgumentList, " ")
Set oWShell = CreateObject("WScript.Shell")
iReturn = oWShell.Run(sCmd, 0, True)
End If
WScript.Quit iReturn