Sample Script: TLuaPowershell (Windows Scripting)
--Create a script file named test.vbs in your C:\temp folder
--(on the remote device) for this sample to work.
--The file should look like this:
strFile = WScript.Arguments(0)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strFile)
strFileSize = objFile.Size
WScript.Echo strFile & " is " & strFileSize & " bytes."
--The script takes one parameter. That is the path to a file
--used for checking the file size.
bExitStatus = false
PS = TLuaPowershell()
bStatus = PS:Open(5985, false)
if bStatus == true then
sCmd = "cscript /Nologo C:\\temp\\test.vbs \n"
bExec = PS:ExecuteCommand(sCmd)
if bExec == true then
sStatus = PS:GetStdOut()
bExitStatus = true
else
sStatus = "Execute failed. " .. PS:GetStdErr()
end
else
sStatus = "Failed to open connection. " .. PS:GetErrorDescription()
end
SetExitStatus(sStatus, bExitStatus)