It's now been a decade since I've supported Zenworks in a commercial environment... it really was a gret product. There was no PowerShell and every engineer used a bag full of DOS type utilities to overcome limitations with supporting machines.
It was a real surprise to hear of a colleague needing to convert Zenworks SnapApps for a modern rollout. Installshield (if you have a license) can / could convert Netware AXT files but the quality of the MSI produced was poor. It was far cleaner to create a standalone installer that could be recaptured independently on a clean system.
The script below is extremely old and if I had a need to convert AXT files again I'd take the time to PowerShell it up & bring it into the modern age. That said, there are not many resources available for techs to leverage when dealing with such old technology. In that spirit, the script may be of use to some.
As always, it's far better to use a vendor supplied, modern installer when capturing for a new Operating System release... only when that isn't an option (and ofter original installers have been lost) does AXT conversion become a sensible approach.
[[vb]] ' ************************** ' NAL AXT Conversion to CMD ' Laurie Rhodes 2003 ' ' Requires NAL directory to be writeable ' Uses nircmd for batch operations http://www.nirsoft.net/utils/nircmd.html ' *************************** set FSO=Wscript.CreateObject("scripting.FileSystemObject") Set objArgs = WScript.Arguments '**************************************** 'Script '**************************************** AXTLocation ="" NALdir ="" 'See if the script has been called with parameters For I = 0 to objArgs.Count - 1 StartParams=objArgs(I) StartParams=ucase(StartParams) if right(StartParams,4)=".AXT" then AXTLocation = objArgs(I) end if Next 'Select the AXT for conversion 'Only produce a GUI if AXT parameters have not already been passed if AXTLocation ="" Then msgbox "Select the AXT File for Validation" AXTLocation = fBrowseForFile else End if NALdir = Left(AXTLocation, instrrev(AXTLocation, "\")) Set file = fso.OpenTextFile(AXTLocation, 1,,0) 'file for read as ANSI Set outfile = fso.OpenTextFile(NALDIR &"~Output.txt", 2,1,0) 'file for write 'First we are goint to tag each of the lines within the axt to identify what function it represents Do While Not file.AtEndofStream 'Lets read the axt FileLine = file.Readline ' msgbox fileline If instr(FileLine,"[") = 1 then varTag= FileLine else if FileLine ="" then else Fileline = Vartag &fileline end if end if outfile.writeline(fileline) Loop outfile.close file.close 'Now we are going to open our resulting file and piece together the Registry editing instructions Set file = fso.OpenTextFile(NALDIR &"~Output.txt", 1,,0) 'file for read as ANSI Set outfile = fso.OpenTextFile(NALDIR &"~Output2.txt", 2,1,0) 'file for write variableType ="" 'Reset our variables for the next registry block varName="" varValue="" varkey="" Do While Not file.AtEndofStream 'Lets read the file FileLine = file.Readline 'msgbox fileline If instr(FileLine,"[Registry Value Create]") = 1 then 'we know it's a Registry creation section If instr(FileLine,"[Registry Value Create]Type=") = 1 then 'It is a data Type we need to change 'The format of Data type variableType = right(FileLine,len(FileLine)-28) If instr(variableType,"DWORD") = 1 then variableType = "DWORD" end if If instr(variableType,"String") = 1 then variableType = "SZ" end if If instr(variableType,"Binary") = 1 then variableType = "BINARY" end if If instr(variableType,"Default") = 1 then variableType = "SZ" end if end if If instr(FileLine,"[Registry Value Create]Key") = 1 then varKey = right(FileLine,len(FileLine)-27) 'If this is a key 'We have to convert the long notation 'of Registry roots into short form If instr(varKey,"HKEY_LOCAL_MACHINE") = 1 then varkey = "HKLM" &right(varkey,len(varkey)-18) end if If instr(varKey,"HKEY_CURRENT_USER") = 1 then varkey = "HKCU" &right(varkey,len(varkey)-17) end if If instr(varKey,"HKEY_CLASSES_ROOT") = 1 then varkey = "HKCR" &right(varkey,len(varkey)-17) end if If instr(varKey,"HKEY_CURRENT_CONFIG") = 1 then varkey = "HKCC" &right(varkey,len(varkey)-19) end if If instr(varKey,"HKEY_USERS") = 1 then varkey = "HKU" &right(varkey,len(varkey)-10) end if end if If instr(FileLine,"[Registry Value Create]Name") = 1 then varName = right(FileLine,len(FileLine)-28) end if If instr(FileLine,"[Registry Value Create]Value") = 1 then ' Possible multi - line if binary type tempvar = right(FileLine,len(FileLine)-29) if varValue = "" then 'If preexisting value set for varvalue then varValue = tempvar else varValue = varValue=varValue &" " &tempvar end if end if end if if Fileline = "" then 'now we start manipulating the results if varkey ="" then'all valid entries must have a registry key 'no key exists else if variableType ="" then variableType = "sz" end if Actionline = "nircmd regsetval " &variableType &" " &chr(34) &varKey &chr(34) &" " &chr(34) &varname &chr(34) &" " &chr(34) &varValue &chr(34) &" " end if 'we should now have a valid reg string for a batch file. If Actionline="" then 'ignore any blank lines else if lastActionLine=ActionLine then 'make sure the last line isn't duplicated else 'for every line in the source file outfile.writeline(ActionLine) end if end if lastActionLine=ActionLine variableType ="" 'Reset our variables for the next registry block varName="" varValue="" varkey="" end if loop outfile.close file.close 'We have now successfully converted all of the registry entrys from the NAL 'We have to account for the remaining NAL categories Set file = fso.OpenTextFile (NALDIR &"~Output.txt", 1,,0) 'file for read as ANSI Set outfile = fso.OpenTextFile(NALDIR &"~Output2.txt", 8,1,0) 'file for write (Appending this time) ' 'Let's do the INI additions ' Do While Not file.AtEndofStream 'Lets read the file FileLine = file.Readline 'msgbox fileline If instr(FileLine,"[INI Identifier Create]") = 1 then If instr(FileLine,"[INI Identifier Create]File=") = 1 then varfile = right(FileLine,len(FileLine)-28) end if If instr(FileLine,"[INI Identifier Create]Section=") = 1 then varSection = right(FileLine,len(FileLine)-31) end if If instr(FileLine,"[INI Identifier Create]Identifier=") = 1 then varIdentifier = right(FileLine,len(FileLine)-34) end if If instr(FileLine,"[INI Identifier Create]Value=") = 1 then varValue = right(FileLine,len(FileLine)-29) end if end if Actionline = "nircmd inisetval " &chr(34) &varfile &chr(34) &" " &chr(34) &varSection &chr(34) &" " &chr(34) &varIdentifier &chr(34) &" " &chr(34) &varValue &chr(34) 'we have come to an end of a section so it's time to write the 'Action Command if Fileline = "" then if varfile ="" then 'we haven't finished an ini section, carry on with script ' If Actionline="" then 'ignore any blank lines else ' if lastActionLine=ActionLine then 'make sure the last line isn't duplicated ' else 'for every line in the source file 'IF Varname ="" then 'else if varvalue ="" then 'make sure that only a correct ini entry is attempted to be written else outfile.writeline (ActionLine) ' end if 'end if 'end if end if lastActionLine=ActionLine varfile ="" 'Reset our variables for the next iteration varSection="" varIdentifier="" varValue="" end if end if Loop outfile.close file.close Set file = fso.OpenTextFile(NALDIR &"~Output.txt", 1,,0) 'file for read as ANSI Set outfile = fso.OpenTextFile(NALDIR &"~Output2.txt", 8,1,0) 'file for write (Appending this time) ' 'Let's Create Directories ' Do While Not file.AtEndofStream 'Lets read the file FileLine = file.Readline If instr(FileLine,"[Directory Create]") = 1 then If instr(FileLine,"[Directory Create]Directory=") = 1 then varDirectory = right(FileLine,len(FileLine)-28) end if end if Actionline = "nircmd execmd mkdir " &chr(34) &varDirectory &chr(34) 'we have come to an end of a section so it's time to write the 'Action Command if Fileline = "" then if varDirectory ="" then 'we haven't finished a valid section, carry on with script ' If Actionline="" then 'ignore any blank lines else ' if lastActionLine=ActionLine then 'make sure the last line isn't duplicated ' else 'for every line in the source file outfile.writeline(ActionLine) ' end if 'end if lastActionLine=ActionLine varDirectory ="" 'Reset our variables for the next iteration end if end if Loop outfile.close file.close Set file = fso.OpenTextFile(NALDIR &"~Output.txt", 1,,0) 'file for read as ANSI Set outfile = fso.OpenTextFile (NALDIR &"~Output2.txt", 8,1,0) 'file for write (Appending this time) ' 'Let's do the Files now ' Do While Not file.AtEndofStream 'Lets read the file FileLine = file.Readline If instr(FileLine,"[File Copy]") = 1 then If instr(FileLine,"[File Copy]Source=") = 1 then varSource = right(FileLine,len(FileLine)-18) end if If instr(FileLine,"[File Copy]Target=") = 1 then varTarget = right(FileLine,len(FileLine)-18) end if end if Actionline = "nircmd execmd copy " &chr(34) &varSource &chr(34) &" " &chr(34) &varTarget &chr(34) 'we have come to an end of a section so it's time to write the 'Action Command if Fileline = "" then if varSource ="" then 'we haven't finished a valid section, carry on with script ' If Actionline="" then 'ignore any blank lines else ' if lastActionLine=ActionLine then 'make sure the last line isn't duplicated ' else 'for every line in the source file outfile.writeline(ActionLine) ' end if 'end if lastActionLine=ActionLine varSource ="" 'Reset our variables for the next iteration varTarget="" end if end if Loop outfile.close file.close Set file = fso.OpenTextFile(NALDIR &"~Output.txt", 1,,0) 'file for read as ANSI Set outfile = fso.OpenTextFile(NALDIR &"~Output2.txt", 8,1,0) 'file for write (Appending this time) ' 'Let's Do Shortcuts now ' Do While Not file.AtEndofStream 'Lets read the file FileLine = file.Readline If instr(FileLine,"[Shortcut Add]") = 1 then If instr(FileLine,"[Shortcut Add]Link File Path=") = 1 then varLinkFilePath = right(FileLine,len(FileLine)-29) if instr(varLinkFilePath,"\") > 0 then 'We need to split this string into two components for nircmd to work correctly tempvar=InstrRev(varLinkFilePath,"\",-1,1) varFilename=Right(varLinkFilePath, len(varLinkFilePath)-tempvar) 'we still need to get rid of the file extension varFilename=Left(varFilename, len(varFilename)-4) varLinkFilePath=Left(varLinkFilePath, tempvar-1) end if end if If instr(FileLine,"[Shortcut Add]EXE Path=") = 1 then varExePath = right(FileLine,len(FileLine)-23) end if If instr(FileLine,"[Shortcut Add]Command-line=") = 1 then varCommandLine = right(FileLine,len(FileLine)-27) end if If instr(FileLine,"[Shortcut Add]Icon Path=") = 1 then varIconPath = right(FileLine,len(FileLine)-24) end if If instr(FileLine,"[Shortcut Add]Icon Index=") = 1 then varIconIndex = right(FileLine,len(FileLine)-25) end if If instr(FileLine,"[Shortcut Add]Working Directory=") = 1 then varWoringDir = right(FileLine,len(FileLine)-32) end if end if Actionline = "nircmd shortcut " &chr(34) &varExePath &chr(34) &" " &chr(34) &varLinkFilePath &chr(34) &" " &chr(34) &varFileName &chr(34) &" " &chr(34) &varLinkFileName &chr(34) &" " &chr(34) &varCommandLine &chr(34) &" " &chr(34) &varIconPath &chr(34) &" " &chr(34) &varIconIndex &chr(34) &" " &chr(34) &varWoringDir &chr(34) &" " 'we have come to an end of a section so it's time to write the 'Action Command if Fileline = "" then if varExePath ="" then 'we haven't finished a valid section, carry on with script ' If Actionline="" then 'ignore any blank lines else ' if lastActionLine=ActionLine then 'make sure the last line isn't duplicated ' else 'for every line in the source file outfile.writeline(ActionLine) ' end if 'end if lastActionLine=ActionLine varFilename ="" 'Reset our variables for the next iteration varLinkFilePath ="" 'Reset our variables for the next iteration varExePath ="" 'Reset our variables for the next iteration varCommandLine ="" 'Reset our variables for the next iteration varIconPath ="" 'Reset our variables for the next iteration varIconIndex ="" 'Reset our variables for the next iteration varWoringDir ="" 'Reset our variables for the next iteration end if end if Loop outfile.close file.close 'We have now converted everything of importance 'We have to convert the variables used in our installer script 'We have a series of predefined variables that can be used 'msgbox "Opening Tempfile for Conversion " &NALDIR &"~Output2.txt" Set file = fso.OpenTextFile(NALDIR &"~Output2.txt", 1,,0) 'file for read as ANSI strText = File.ReadAll 'read the context into memory File.Close 'close the file so we can write over it 'now we list all of the variables we wish to change 'there will be more strText = Replace(strText, "%*APPDATA%\", "~$folder.appdata$\") strText = Replace(strText, "%*APPDATA%", "~$folder.appdata$") strText = Replace(strText, "%*COMMONDESKTOP%\", "~$folder.common_desktop$\") strText = Replace(strText, "%*COMMONDESKTOP%", "~$folder.common_desktop$") strText = Replace(strText, "%*COMMONPROGRAMS%\", "~$folder.common_programs$\") strText = Replace(strText, "%*COMMONPROGRAMS%", "~$folder.common_programs$") strText = Replace(strText, "%*COMMONSTARTMENU%\", "~$folder.common_start_menu$\") strText = Replace(strText, "%*COMMONSTARTMENU%", "~$folder.common_start_menu$") strText = Replace(strText, "%*COMMONSTARTUP%\", "~$folder.common_startup$\") strText = Replace(strText, "%*COMMONSTARTUP%", "~$folder.common_startup$") strText = Replace(strText, "%*COMMONWINDESKTOP%\", "~$folder.common_desktop$\") strText = Replace(strText, "%*COMMONWINDESKTOP%", "~$folder.common_desktop$") strText = Replace(strText, "%*COOKIES%\", "~$folder.cookies$\") strText = Replace(strText, "%*COOKIES%", "~$folder.cookies$") strText = Replace(strText, "%*DESKTOP%\", "~$folder.common_desktop$\") strText = Replace(strText, "%*DESKTOP%", "~$folder.common_desktop$") strText = Replace(strText, "%*FAVORITES%\", "~$folder.favorites$\") strText = Replace(strText, "%*FAVORITES%", "~$folder.favorites$") strText = Replace(strText, "%*FONTS%\", "~$folder.windows$\Fonts\") strText = Replace(strText, "%*FONTS%", "~$folder.windows$\Fonts") strText = Replace(strText, "%*HISTORY%\", "~$sys.USERPROFILE$\Local Settings\History\") strText = Replace(strText, "%*HISTORY%", "~$sys.USERPROFILE$\Local Settings\History") strText = Replace(strText, "%*HOMEDRIVE%\", "~$sys.HOMEDRIVE$\") strText = Replace(strText, "%*HOMEDRIVE%", "~$sys.HOMEDRIVE$") strText = Replace(strText, "%*HOMEPATH%\", "~$sys.HOMEPATH$\") strText = Replace(strText, "%*HOMEPATH%", "~$sys.HOMEPATH$") strText = Replace(strText, "%*NETHOOD%\", "~$sys.USERPROFILE$\Nethood\") strText = Replace(strText, "%*NETHOOD%", "~$sys.USERPROFILE$\Nethood") 'strText = Replace(strText, "%*PERSONAL%\", "~$$\") 'strText = Replace(strText, "%*PERSONAL%", "~$$") strText = Replace(strText, "%*PROGRAMFILES%\", "~$folder.programs$\") strText = Replace(strText, "%*PROGRAMFILES%", "~$folder.programs$") strText = Replace(strText, "%*PROGRAMFILESCOMMON%\", "~$folder.common_programs$\") strText = Replace(strText, "%*PROGRAMFILESCOMMON%", "~$folder.common_programs$") strText = Replace(strText, "%*RECENT%\", "~$folder.recent$\") strText = Replace(strText, "%*RECENT%", "~$folder.recent$") strText = Replace(strText, "%*SENDTO%\", "~$sys.USERPROFILE$\SendTo\") strText = Replace(strText, "%*SENDTO%", "~$sys.USERPROFILE$\SendTo") strText = Replace(strText, "%*STARTMENU%\", "~$folder.start_menu$\") strText = Replace(strText, "%*STARTMENU%", "~$folder.start_menu$") strText = Replace(strText, "%*STARTUP%\", "~$folder.startup$\") strText = Replace(strText, "%*STARTUP%", "~$folder.startup$") strText = Replace(strText, "%*TEMPDIR%\", "~$sys.tmp$\") strText = Replace(strText, "%*TEMPDIR%", "~$sys.TMP$") strText = Replace(strText, "%*TEMPLATES%\", "~$sys.USERPROFILE$\Templates\") strText = Replace(strText, "%*TEMPLATES%", "~$sys.USERPROFILE$\Templates") strText = Replace(strText, "%User_name%\", "~$sys.USERNAME$\") strText = Replace(strText, "%User_name%", "~$sys.USERNAME$") strText = Replace(strText, "%*WINSYSDIR%\", "~$folder.system$\") strText = Replace(strText, "%*WINSYSDIR%", "$folder.system$") strText = Replace(strText, "%*WINDESKTOP%\", "~$folder.windows$\") strText = Replace(strText, "%*WINDESKTOP%", "~$folder.windows$") strText = Replace(strText, "%*WINDIR%\", "~$folder.windows$\") strText = Replace(strText, "%*WINDIR%", "~$folder.windows$") strText = Replace(strText, "%*WINDISK%\", "C:\") strText = Replace(strText, "%*WINDISK%", "C:\") strText = Replace(strText, "%*WINDOWS%\", "~$folder.windows$\") strText = Replace(strText, "%*WINDOWS%", "~$folder.windows$") strText = Replace(strText, "%*WINSYSDISK%\", "C:\") strText = Replace(strText, "%*WINSYSDISK%", "C:\") strText = Replace(strText, "%SOURCE_PATH%\", ".\") strText = Replace(strText, "%SOURCE_PATH%", ".\") 'We have one more special variable to replace and that's %TARGET_PATH% Set file = fso.OpenTextFile(NALDIR &"~Output.txt", 1,,0) 'file for read as ANSI Do While Not file.AtEndofStream 'Lets read the file FileLine = file.Readline If instr(FileLine,"[Macro]") = 1 then If instr(FileLine,"[Macro]Name=") = 1 then varName = right(FileLine,len(FileLine)-12) varname = "%" &varname &"%" end if If instr(FileLine,"[Macro]Value=") = 1 then varValue = right(FileLine,len(FileLine)-13) 'varValue = left(varvalue,len(varValue)-1) end if end if if Fileline = "" then 'We will process the section if varName ="" then 'we haven't finished a valid section, carry on with script ' If Actionline="" then 'ignore any blank lines else 'msgbox "varname = " &varname & "varvalue= " &varvalue strNewText = Replace(strText, varName, varValue) end if end if Loop file.close Set outfile = fso.OpenTextFile(NALDIR &"_Install.cmd", 2,1,0) 'file for write outfile.WriteLine strNewText outfile.Close 'Let's cleanup the old working files too If fso.FileExists(NALDIR &"~Output.txt") Then fso.DeleteFile(NALDIR &"~Output.txt") end if If fso.FileExists(NALDIR &"~Output2.txt") Then fso.DeleteFile(NALDIR &"~Output2.txt") end if '*********************************** ' Functions '*********************************** Function fBrowseForFile() Set oBrowseDialog = CreateObject(" UserAccounts.CommonDialog") oBrowseDialog.Filter = "AXT Files|*.axt" oBrowseDialog.InitialDir = "c:\" oBrowseDialog.Flags = &H80000 + &H4 + &H8 oBrowseDialog.ShowOpen fBrowseForFile = oBrowseDialog.FileName End Function [[/vb]]
- Log in to post comments