Skip to content

Log_SubmitLogs

VB Scripting Library > OSD Scripting Library > Log functions (OSD)

Submits all registered logs to a subfolder under the specified root folder set in the global value gsLogServerFolder.
The logfiles will be copied to a subfolder with the same name as the UUID of the computer.
Before submitting, every value registered with Log_RegisterExcludeValue is replaced with the text ---Value removed by script for security reasons--- in the submitted copies.

No arguments provided.

Boolean, TRUE if function completed successfully.

Typically used in the PreBootScript.wsf

  • OSD_Initialize sets gsLogServerFolder to the Logs folder on the OSD server share. The share is only available when Map legacy SMB Drives is True in Configuring the OSD GUI. Otherwise, set gsLogServerFolder to a folder that the script can write to, as in the example below.
  • The function first removes any logs submitted earlier for the computer, see Log_RemoveLogs.
  • The log file of the running script is closed and submitted last. Call Log_SubmitLogs as the last step of the script, before Job_End.
  • When the files are copied to a file share, the function also creates a shortcut named <computer name> - <UUID> in the _Shortcuts subfolder of gsLogServerFolder. The shortcut points to the computer’s UUID folder under Logs on the OSD server share.
  • If the web service is enabled in OSDGui.ini, files are submitted to this service instead of copying files to a file share.

The following example will do the following:

  • Set the global variable gsLogServerFolder to a log share on the OSD server.
  • Add a custom logfile is registered for submit along with the well-known logfiles.
  • Register the product key as an unwanted text string that should be excluded from all files.
  • Submit the logfiles.
Private Function IncludeScript(sScriptFile)
'...
End Function
'Begin
bStatus=True
If bStatus Then bStatus=IncludeScript("customlib.cis")
If bStatus Then bStatus=IncludeLibrary("Capalib.cin")
If bStatus Then bStatus=IncludeLibrary("Osdlib.cin")
If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL")
If bStatus Then bStatus=OSD_Initialize()
gsLogServerFolder="\\" & gsBootServer & "\LogFiles" 'set the log folder root
sProductKey = "11111-22222-33333-44444-55555"
If bStatus Then bStatus=Sysprep_SetProductKey(sProductKey)
If bStatus Then bStatus=Log_RegisterExcludeValue("Product key",sProductKey) 'remove productkey value from logfiles
If bStatus Then bStatus=Log_RegisterWellKnownFiles()
If bStatus Then bStatus=Log_RegisterLogfile("X:\MyTestLog.log") 'register an aditional file to submit
If bStatus Then bStatus=Log_SubmitLogs() 'submit the logs
Job_End(bStatus)
'End main

Scripting Guidelines, Log_RegisterExcludeValue, Log_RegisterWellKnownFiles, Log_RemoveLogs, Log_RegisterLogfile Constants Package Property Variables