Good day,
I am implementing a script in a bundle that allows me to generate files on the fly and execute them. Upon saving my "run script" action, ZENworks takes on himself to parse and edit my script, I am not sure why.
A part of my script generates a .hta file, an html application, that is used as a temporary splash screen. For some reason (line 85) my event name (Windows_onLoad()) is renamed by ZENworks like this :
oFile.WriteLine " Sub Window_onload()"
becomes
oFile.WriteLine " Sub Window_<body <body <body <body <body onload()"
Does that ring a bell for anyone?
I have other means of doing what I want but I wanted to bring this specific issue to you. Let me know what you think. :)
Thank you!
Action parameters :
ZENworks Agent : 11.2.2.121992 & 11.2.3.18535
ZENworks version : 11.2.3.0
I am implementing a script in a bundle that allows me to generate files on the fly and execute them. Upon saving my "run script" action, ZENworks takes on himself to parse and edit my script, I am not sure why.
A part of my script generates a .hta file, an html application, that is used as a temporary splash screen. For some reason (line 85) my event name (Windows_onLoad()) is renamed by ZENworks like this :
oFile.WriteLine " Sub Window_onload()"
becomes
oFile.WriteLine " Sub Window_<body <body <body <body <body onload()"
Does that ring a bell for anyone?
I have other means of doing what I want but I wanted to bring this specific issue to you. Let me know what you think. :)
Thank you!
Action parameters :
Code:
Script to run : 'Define oyur own script'
Script content : *copy of the script found below*
Script file extention : .vbs
Path to script Engine : C:\Windows\system32\wscript.exe
Executable security level : Run as dynamic administrator
Requirements : Registry Key and Value exists
\HKEY_LOCAL_MACHINE\SOFTWARE\Lafleche\ZenworksAssignedObjets - Inst-Coba-x64 - NO
ZENworks version : 11.2.3.0
Code:
set oFSO = CreateObject("Scripting.FileSystemObject")
set oShell = CreateObject("WScript.Shell")
strFileName1 = Replace(oFSO.GetTempName,".tmp",".reg")
strFileName2 = oFSO.GetTempName
strFileName3 = Replace(oFSO.GetTempName,".tmp",".hta")
...
'--------------------------------------------------------------------------------------------------'
set oFile = oFSO.CreateTextFile(strFileName3)
oFile.WriteLine "<!DOCTYPE html>"
oFile.WriteLine "<html>"
oFile.WriteLine " <head>"
oFile.WriteLine " <title>Title</title>"
oFile.WriteLine " <HTA:APPLICATION Caption=""yes"" SysMenu=""yes"" />"
oFile.WriteLine " <script language=""VBScript"">"
oFile.WriteLine ""
oFile.WriteLine " Sub Window_onload()"
oFile.WriteLine " "
oFile.WriteLine " window.resizeTo 500,250"
oFile.WriteLine " "
oFile.WriteLine " strComputer = ""."""
oFile.WriteLine " Set objWMIService = GetObject(""winmgmts:\\"" & strComputer & ""\root\cimv2"")"
oFile.WriteLine " Set colItems = objWMIService.ExecQuery(""Select * From Win32_DesktopMonitor"")"
oFile.WriteLine " "
oFile.WriteLine " For Each objItem in colItems "
oFile.WriteLine " intHorizontal = objItem.ScreenWidth"
oFile.WriteLine " intVertical = objItem.ScreenHeight "
oFile.WriteLine " Next"
oFile.WriteLine " "
oFile.WriteLine " intLeft = (intHorizontal - 500) / 2"
oFile.WriteLine " intTop = (intVertical - 250) / 2"
oFile.WriteLine " window.moveTo intLeft, intTop "
oFile.WriteLine " idTimer = window.setTimeout(""PausedSection"", 8000, ""VBScript"")"
oFile.WriteLine " "
oFile.WriteLine " End Sub"
oFile.WriteLine " "
oFile.WriteLine " Sub PausedSection"
oFile.WriteLine " window.close"
oFile.WriteLine " End Sub"
oFile.WriteLine ""
oFile.WriteLine " </script>"
oFile.WriteLine " </head>"
oFile.WriteLine " <body>"
oFile.WriteLine " "
oFile.WriteLine " <img src=""http://www.domain.com/logo.png"" alt="""" />"
oFile.WriteLine " "
oFile.WriteLine " <p>Installation underway...</p>"
oFile.WriteLine " "
oFile.WriteLine " </body>"
oFile.WriteLine "</html>"
oFile.Close
'--------------------------------------------------------------------------------------------------'
...
oShell.Run strFileName3, 0, true
'oFSO.DeleteFile strFileName3