Migrating Software Delivery Tasks
Part of nearly every Altiris Notification Server implementation includes Software Delivery. Software Delivery enables us to, well, deliver software, but also provides us distribution points, policy-based actions on client computers, and repeatable, dependent rollout of system and application changes. No doubt the longer you have utilized Software Delivery, the more collections, packages, and tasks you have created. When it comes time to rebuild your Notification Server or move to a new NS, migrating the SWD infrastructure can become very, very time consuming. This article will demonstrate how to migrate your existing SWD tasks to a newly built server without recreating all the necessary items by hand.
Software Delivery Solution Overview
A typical software delivery by Altiris has three components - a computer collection, a reference to a Windows program and package, and a software delivery task. The collection defines what computers will have this SWD task applied to, the Windows package defines the actual command line and package files used, and the task ties the collection and package together, controlling the schedule of when the program in the package will be run against the computers in the collection. It is these three pieces which must be exported out of the old Notification Server and into the new Notification Server.
Moving Items Manually
You can move a single item manually by going into the Altiris Console (I'll be using Console 6.5 for this article), right-clicking on an item on the Tree View, and choosing "Export".
You will be prompted to save an XML file, so save it anywhere you like. This XML file contains all the necessary about the item, including name, GUID, class type, resource associations, and parent folder guids. To import this file into the new Notification Server, go the location you want to import the item into, right-click on the folder you want the item imported in, and click "Import".
You can export and import one item at a time this way, and it works for nearly everything I the Notification Server.
Moving Multiple/Large Items
Most of the time when migrating to a new server, you will want to move collections/packages/tasks in batches. Or perhaps you have an item that is simply too large to import into your new Notification Server and you receive the error: "Error importing item: The file is too big to open". Altiris provides a nice little utility to import batches of items and items that are simply too large to import on their own. This is called the importexportutil.exe. This file can be found in C:\Program Files\Altiris\Diagnostics (or wherever you installed your Notification Server, in the Diagnostics directory). Importexportutil.exe runs in a command prompt, and there is no GUI for it. It can be used both to import and export items as necessary.
Exporting with Importexportutil.exe
- Identify a file system folder you want the item(s) exported to (e.g. C:\Exported Items).
- Get the GUID of the item you want to export. You can do this by locating the item on your Notification Server on the Tree View or right-hand pane, right-clicking on the item and choosing Properties. A new window will open and display (among other things), the item's GUID. This will also work for folders so you can export the folder itself and all items within it!
- Go to the start menu, choose "Run". Type "cmd" in the Run box and hit enter.
- Go to the diagnostics directory of the Notification Server (e.g. "cd C:\Program Files\Altiris\Diagnostics").
- Type "importexportutil.exe <guid> <location to export to>" (e.g. ImportExportUtil.exe /export {cee52b96-748a-4dd2-bd67-064f019a9d24} "D:\Exported Items")
- Now go to your folder and verify you have one or more XMLs (you will have more than one if you exported a folder which contains items within it).
Importing with ImportExportutil.exe
- Go to the start menu, choose "Run". Type "cmd" in the Run box and hit enter.
- Go to the diagnostics directory of the Notification Server (e.g. "cd C:\Program Files\Altiris\Diagnostics").
- Type "importexportutil.exe <folder where the XML files are held> (e.g. "ImportExportUtil.exe /import "D:\Exported Items")
- Open your browser to the Altiris Console and verify the item exists in the same location as it existed in the previous Notification Server.
Some Things to Note:
- With this method you can simply export the entire "Windows" folder for your Windows packages and it will import itself into the proper directory!
- If your packages reference source files and those source files are on the first Notification Server, remember to copy the source files to your new Notification Server as the importexportutil.exe does not facilitate that.
- If you export/import collections with inclusions and exclusions (either resource or collections), those additions will not be retained if those resources/collections do not exist in the Notification Server you are importing to. This is because the collection's XML file contains the GUIDs of the items being included and/or excluded, and that information will not import if it does not find these GUIDs in the database. When importing collections with inclusions or exclusions, make sure you import the excluded or included items before you import the collection which relies on the previous items.
- This will not work for Sequential Software Delivery Tasks. They have many resource associations and dependencies and the importexportutil.exe does not properly export or import those. You can however, migrate the packages and collections it uses.
- This will not work for Patch Management. This includes Software Update Tasks, Security Updates, and Security Bulletins. This is because the importexportutil.exe does not create the IIS virtual directories when you import a security update or bulletin. The IIS virtual directories are only created when staging a bulletin. This staging also generates a unique GUID that a Software Update Task uses to properly associate itself with the security update which provides it the command line. Since the staging creates unique GUIDs and the Software Update Task references these unique GUIDs, it does not help to import the Software Update Task. You can however, migrate the collections a software update task uses, if you maintain specific collections for the purposes of rolling out patches.






importexportutil is cool, but...
We have 6 NS servers (is that like saying "NIC card"? <:-| ) that we have to keep synced up regarding app collections an application. It's a real bear to do but it's possible to do, especially with this utility. I wrote a script that is set to run on a schedule on each of the NSs. When I need to push out apps/collections/tasks, I just set it up on our dev NS, then export and copy it to a share on each of the NSs. I hope this might help.
Two things EMercado didn't bullet point, this utility will over write objects if there are conflicting GUIDs. I learned that the hard way when one of the guys set up the base collections that pushed out package server policies, then tweaked each one on the NS once imported. Stupid me exported the entire collections folder and used this util to import it on the other NSs. Well, b/c the collections were the same GUID, but had different includes behind each one, the collections were overwritten. It took us about a day to set all the package servers back up.
Second (that I have seen so far) is if you set up your applications to use "Package servers automatically with manual prestaging" and AD sites to pre-stage to the package servers, those selected manually will not import properly. None of the selected sites will be selected b/c those AD import collections are created with unique GUIDs and don't port over. There really needs to be an ASDK to help with this. If there is, I haven't seen it.
Any poop, hope this helps. I also hope all this need for my kind of replication is fixed in NS 7.
' Author: Jon Mason
' Date: 8/27/08
' Function: imports xml files on server using ImportExportUtil.exe
'denote import folder to watch for.
xmlDir = "E:\XMLImport"
'set dim and objects to be used in script
dim readcheck, SysDir, wsh, fso, saveOver
Set wsh = CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
SysDir = fso.GetSpecialFolder(1)
If NOT fso.FolderExists(xmlDir) Then
wscript.quit
End If
strAltirisReg = "HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\InstallPath"
'check to see of the user has a screen saver set
if RegVerify(strAltirisReg) then
strAltirisDir = WSH.RegRead (strAltirisReg)
strExportUtil = strAltirisDir & "Diagnostics\ImportExportUtil.exe"
if fso.FileExists(strExportUtil) then
Set FSO = CreateObject("Scripting.FileSystemObject")
'check for, import then delete xml files
'~ Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(xmlDir)
Set fc = f.Files
For Each f1 in fc
nameSplit = Split(f1, ".", -1, 1)
if nameSplit(UBound(nameSplit)) = "xml" then
cmd = """" & strExportUtil & """ /import /q """ & xmlDir & "\" & f1.name & """"
'~ msgbox cmd
wsh.Run cmd,0,true
Set objFileCopy = FSO.GetFile(xmlDir & "\" & f1.name)
objFileCopy.Delete ()
end if
Next
end if
else
'something is wrong
end if
'process complete
'############### Functions ###############
'function to verify if a reg value exists
Public Function RegVerify(ByVal sRegEntry)
On Error Resume next
Dim WSH, sKeyTmp
Set WSH=CreateObject("WScript.Shell")
sKeyTmp = WSH.RegRead (sRegEntry)
if err.number=0 then
RegVerify = True
Addlog sRegEntry & " was found"
else
RegVerify = False
Addlog sRegEntry & " was NOT found"
end if
err.clear
On Error goto 0
End Function
Thanks for the extra notes!
Masonje, when I wrote it this article I had intended it to be a way for people to move from one NS to another without having to rewrite all their SWD tasks/packages/collections. That's actually pretty cool you are using importexportutil to sync between NSses, but yes this will overwrite items with the same GUID. As for the package server and AD site issue, this is the same type of issue as trying to move staged software update packages and Software Update tasks - there are so many tie-ins to specific GUIDs created on the fly there is no simple way to track down all associations and export those too. I hear with the NS hierarchy tools in NS 7, this will be accomplished.
Would you like to reply?
Login or Register to post your comment.