About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
I have created a little tool for myself that I have call Altiris Job Builder, it retreives the Jobs from the Altiris database and shows them in a Treeview.
Then I can assemble a Master Build Job by dragging the needed Jobs to another Treeview on the right. Since it’s just for me it doesn’t have a fancy gui:
So why did I write it? Well I have divided my Jobs into Prerequisites and Packages, for instance IIS and Terminal Server and Java are prereqisuites for Citrix. But many prereqisuites are required for one or more other packages, eg Java is also used for certain applications.I don’t want to make copies of Jobs since that means I have to change it in multiple places. For instance say we upgrade to a new Java version we would need to update multiple jobs instead of one (which is very likely to wrong ).
So the idea behind this master build is to create a Master Build Job that fires off all the needed jobs for a certain package. I use AxSched in an integrated script job for that. So my tool generates something like this:
rem My Jobs\PKG\p003.Citrix_Prereqisuites\02.Java
AxSched %COMPNAME% -jid 2000266 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p003.Citrix_Prereqisuites\03.Web-Server
AxSched %COMPNAME% -jid 2000267 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p003.Citrix_Prereqisuites\05.TS_TerminalServer!
AxSched %COMPNAME% -jid 2000269 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p003.Citrix_Prereqisuites\08.VisualJ#
AxSched %COMPNAME% -jid 2000272 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p003.Citrix_Prereqisuites\06.CtxClient
AxSched %COMPNAME% -jid 2000270 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p015.Citrix_AddServer\02.InstallCitrix!
AxSched %COMPNAME% -jid 2000295 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p013.CitrixComponents\01.DeliveryServicesConsole
AxSched %COMPNAME% -jid 2000287 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p013.CitrixComponents\02.CMC
AxSched %COMPNAME% -jid 2000289 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p013.CitrixComponents\04.HDX
AxSched %COMPNAME% -jid 2000290 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p013.CitrixComponents\03.EnableFP2
AxSched %COMPNAME% -jid 2000293 /t %TIME:~0,5% /ulu
rem My Jobs\PKG\p014.CitrixHotFixes\01.HotfixRollup6!
AxSched %COMPNAME% -jid 2000292 /t %TIME:~0,5% /ulu
But lazy as I am I don’t want to manually copy/paste this into a job but rather insert it directly into the database. If we look at the eXpress database scheme we can see that there is an event table (a Job is really an Event in Altiris):
Only the event_id field is mandatory and it’s also the Primary Key of the table. However the event_id is not auto generated so if we insert a new record how do we now the right value for event_id?
One approach could be to read the highest value and increment that by 1 but that seems dangerous for various reasons. So I figured there was probably a Stored Procedure for adding a new Job/Event.
In the SQL Server Management Studio we can find Stored Procedures under the Programmability Node of the Database:
If you look into the available Stored Procedures you will see that there are del_xxx and ins_xxx events. We need the ins_event Stored Procedure:
In Delphi we can use the TADOCommand object to call a Stored Procedure:
function TForm1.AddEvent(const FolderId: Integer; const Name: String;
const Description: String=''): Integer;
Result := -1;
cmd := TADOCommand.Create(nil);
cmd.Connection := ADOConnection1;
cmd.CommandType := cmdStoredProc;
cmd.CommandText := 'ins_event';
cmd.Parameters.ParamByName([email protected]').Value := Name;
cmd.Parameters.ParamByName([email protected]_id').Value := FolderId;
cmd.Parameters.ParamByName([email protected]').Value := Description;
Result := cmd.Parameters.ParamValues[[email protected]_VALUE'];
The ins_event Stored Procedure returns the new JobId in the @RETURN_VALUE parameter. This is very convenient because we need the JobId to add tasks to the new Job, in this case a script task.
But enough talk for today, I hope you find the subject interesting and I would be very interested to hear about other solutions or concepts for a Master Build Job.
.NET .NET FrameWork Active Directory Altiris Apple Automation Manager Citrix Dell Delphi Excel Exchange Exchange2003 Exchange2010 Hack HP iOS Java LinkedIn Linux Lync MSI Office Office 2010 Passat Password PowerPoint PowerShell RES RNS510 SasLibEx SCOM Security Terminal Server ThinApp TSAdminEx VBS VCDS Visual Basic Visual Studio VMWare Volkswagen VW Windows PE Wordpress XenApp