I have a VBScript function to query for logon sessions. The script works fine when not packaged with PrimalScript 2012. The script produces the output just fine.
However, when the script was packaged with PrimalScript 2012, the packaged script failed to work. There is no error out put from the packaged script either. It just went silent. It does not matter what Engine type I packaged it with, it just failed to produce the output.
Below is the function.
VBScript Code
Double-click the code block to select all.strComputer = CreateObject("Wscript.Network").ComputerName GetLogonSessions strComputer Function GetLogonSessions(strComputer) Dim objRegEx, objShell, objExecObject, strSearch, strLine Dim strUserName, intSession Set objRegEx = CreateObject("VBScript.RegExp") With objRegEx .Global = True .IgnoreCase = True .Pattern = "\s{2,20}" End With Set objShell = CreateObject("WScript.Shell") Set objExecObject = objShell.Exec("cmd /c qwinsta /server:" _ & strComputer) Do Until objExecObject.StdOut.AtEndOfStream strSearch = "" : strUserName = "" : intSession = "" strLine = Trim(objExecObject.StdOut.ReadLine) 'Get disconnected sessions. If InStr(strLine,"Disc") > 0 And InStr(strLine,"service") = 0 Then strSearch = objRegEx.Replace(strLine,";") strUserName = Split(strSearch,";")(0) intSession = Split(strSearch,";")(1) WScript.Echo strUserName & ";" & intSession End If 'Get active sessions. strSearch = "" : strUserName = "" : intSession = "" If InStr(strLine,"Active") > 0 And InStr(strLine,"service") = 0 Then strSearch = objRegEx.Replace(strLine,";") strUserName = Split(strSearch,";")(1) intSession = Split(strSearch,";")(2) WScript.Echo strUserName & ";" & intSession End If Loop 'Clean up. Set objRegEx = Nothing: Set objShell = Nothing Set objExecObject = Nothing End FunctionThak you in advance.