MDT customsettings.ini userexit and multiple variables

Symbiot 21 Reputation points
2021-05-21T07:23:51.007+00:00

Hi everyone,

I have userexit script that is querying a MySQL database:

Part of the file that is returned (writing from memory so it can contains typos but you can get idea) :
Do Until objRS.EOF
strReturn = strReturn & objRS.Fields("job_no") & _
objRS.Fields("table1") & ("|") & _
objRS.Fields("table2") & ("|") & _
objRS.Fields("table3") & ("|") & _
objRS.Fields("table4") & ("|") & _
objRS.Fields("table5") & ("|") & _
objRS.Fields("table6") & ("|") & _
objRS.Fields("table7") & ("|") & _
objRS.MoveNext
Loop
If strReturn = "" Then
WScript.Echo "nothing returned - check if record exists in database"
Else
MySQL_JobQuery = strReturn
End If

objRS.Close
objCN.Close

I know MDT doesn't support MySQL but in our environment, we have 2x databases and I need to query both of them to pick the right image (SQL) based on details from MySQL before deployment even starts - and have to happen before any TS.

The query for MySQL works in windows PE and it returns a combined string as "table1|table2|table3.." etc and assigns it to
(customsettings.ini section)
MySqlQuery=#MySQL_JobQuery()#

My question is:
Is it possible to assign in userexit script more than one variables (not only MySqlQuery) used by MDT or do I have to write another script that split that string and then assign them like so

[variable1]
userexit=stringoperation.vbs
VariableTable1=#GetStringTable1("%MySqlQuery%)#
.
.
.

Maybe there's a better way of doing so.

Microsoft Deployment Toolkit
Microsoft Deployment Toolkit
A collection of Microsoft tools and documentation for automating desktop and server deployment. Previously known as Microsoft Solution Accelerator for Business Desktop Deployment (BDD).
859 questions
0 comments No comments
{count} votes

Accepted answer
  1. AllenLiu-MSFT 43,061 Reputation points Microsoft Vendor
    2021-05-24T08:18:02.42+00:00

    Hi, @Symbiot
    Thank you for posting in Microsoft Q&A forum.
    A user exit script can contain one or more functions (not only MySQL_JobQuery), then you could get different VariableTable from different function.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful