It there a limit to how long an online script can run or how much output it can generate?
I have a .bat script that I manually run remotely using psexec on Windows to reset the WMIC on K1000 clients that have stopped reporting their inventory. (They will show as online in KACE and stay online for hours, but the "last inventory" field will say several months ago - even if I force inventory.) Resetting the WMIC solves the inventory problem. So, I put that .bat file as a dependency of a K1000 script, created a smart tag that gathers clients that are online but haven't been inventoried for 1+ months, and runs that .bat file against them. The script runs and says that it completes successfully, but those machines still don't inventory. I looked at the logs from the run of the script, and it says it ran for 30-40 seconds (which is faster than when I run the .bat manually against clients), and the logged output from the .bat file is truncated partway through the log.
Is there any limit on Kace script runtime or the amount of output it generates? The .bat file generates a LONG output because it is iteratively calling the Microsoft MOF compiler on all of the WMIC files.
Here is the .bat itself:
echo off
net stop winmgmt
cd %windir%\system32\wbem
if exist Repos_backup rd Repos_backup /s /q
rename Repository Repos_backup
net start winmgmt
c:\windows\sysnative\winmgmt.exe /resetrepository
c:\windows\sysnative\winmgmt.exe /salvagerepository
winmgmt.exe /resyncperf
regsvr32 /s %systemroot%\System32\scecli.dll
regsvr32 /s %systemroot%\System32\userenv.dll
for /f %%s in ('dir /b /s %windir%\System32\wbem\*.dll') do regsvr32 /s %%s
for /f %%s in ('dir /b /s %windir%\System32\wbem\*.exe') do regsvr32 /s %%s
for /f %%s in ('dir /b /s %windir%\System32\wbem\*.mfl') do mofcomp %%s
for /f %%s in ('dir /b /s %windir%\System32\wbem\*.mof') do mofcomp %%s
wmiprvse /regserver
cd %windir%
if exist CCM rd CCM /s /q
if exist ccmcache rd ccmcache /s /q
if exist ccmsetup rd ccmsetup /s /q
if exist SMS*.INI del SMS*.INI /s /q
if exist SMS*.mif del SMS*.mif /s /q
cd %windir%\System32
if exist CCM rd CCM /s /q
if exist ccmcache rd ccmcache /s /q
if exist ccmsetup rd ccmsetup /s /q
exit
The last few lines of the "output log" from a run of this script through the K1000:
line of the MOF file.Done!
Microsoft (R) MOF Compiler Version 10.0.19041.1
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: C:\Windows\System32\wbem\wlan.mof
MOF file has been successfully parsed
Storing data in the repository...
WARNING: File C:\Windows\System32\wbem\wlan.mof does not contain #PRAGMA AUTORECOVER. If the WMI repository is rebuilt in the future, the contents of this MOF file will not be included in the new WMI repository. To include this MOF file when the WMI Repository is automatically reconstructed, place the #PRAGMA AUTORECOVER statement on the first line of the MOF file.
Done!
Microsoft (R) MOF Compiler Version 10.0.19041.1
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: C:\Windows\System32\wbem\WmiPerfClass.mof
MOF file has been successfully parsed
Storing data in the
As you can see, the log truncates at "storing data in the".... which should say "... the repository" and then continue on with logging the compiling of more files.
And, here is the "debug log" in full:
Running kbot: runkbot 213 1676295493KBotScript::LogScriptInfo - Start
id=213 name=Reset WMIC version=1676295493 type=policy
execute disconnected=false logged_off=true
execute events
KBotScript::LogScriptInfo - Finish
KBotScript::LogScriptInfo - Start
id=213 name=Reset WMIC version=1676295493 type=policy
execute disconnected=false logged_off=true
execute events
KBotScript::LogScriptInfo - Finish
KBotScriptManager::CleanupDependencies - clean up dependencies in kbot directory C:\ProgramData\Quest\KACE\kbots_cache\\packages\kbots\213\
CleanupDependencies: file RepairWMIC.bat is part of the dependency list, keep the file
runkbot ----- launching [path='C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\213' program='repairwmic.bat' parms='' wait='true'] -----
runkbot ----- completed [exitCode=0] -----
runkbot ----- launching [path='C:\Program Files (x86)\Quest\KACE' program='runkbot' parms='4 0' wait='false'] -----
runkbot ----- completed [exitCode=0] -----
Answers (0)
Be the first to answer this question