Ceci est une ancienne révision du document !
7zip
Guide pour la création d'un paquet 7zip prêt à être déployé par OCS Inventory.
Dans un premier temps il faut créer un .zip qui contiendra tous les fichiers nécessaires à la constitution et au déploiement d’un paquet. Pour l'obtenir cliquez sur le lien suivant:7zip.zip
Voici les fichiers qu'il comprend et leur description:
7z.exe: C’est le fichier d’installation de 7zip pour Windows XP. On peut télécharger la dernière version sur cette page: http://www.7-zip.org/ Il faut ensuite renommer le fichier en 7z.exe
install.bat: C’est lui qui sera exécuté par OCS, voici les lignes qu'il contient et leurs fonctions :
cmdow.exe @ /HID wscript.exe //B //Nologo install.vbs
install.vbs: C'est lui qui s'occupe de l'install et de l'association des fichiers:
on error resume next Set objShell = CreateObject("WScript.Shell") installpath = "C:\Program Files\7-Zip\" install = "7z.exe /S /D=" & chr(34) & installpath & chr(34) 'run the install command returned = objShell.run(install,1,true) 'continue to file association of completed install if returned = 0 then 'specify the extensions to register with the program extensionlist = ".7z,.iso,.zip,.rar,.ace,.lzma,.bz2,.bzip2,.tbz,.tbz2,.tar,.gz,.gzip,.tgz,.rpm,.deb,.dmg,.cab" 'create an array with the extenstions from above extensionarray = split(extensionlist,",",-1,1) err.clear 'for each extension do For Each CurrentExt In extensionarray 'delete current file handler deletefiletype(CurrentExt) 'add 7zip association objShell.RegWrite "HKCR\" & CurrentExt & "\" ,"7-Zip.7z" Next 'now create the actuall association objShell.RegWrite "HKCR\7-Zip.7z\" , "7z Archive" 'create icon iconpath = installpath & "7z.dll,0" objShell.RegWrite "HKCR\7-Zip.7z\DefaultIcon\" , iconpath 'create shell action opencmd = chr(34) & installpath & "7zFM.exe" & chr(34) & " " & chr(34) & "%1" & chr(34) objShell.RegWrite "HKCR\7-Zip.7z\shell\open\command\", opencmd 'check if err.number has been set, if so return failed if err.number = 0 then exitcode = 0 else exitcode = 1 end if else exitcode = 1 end if 'exit and return code wscript.quit(exitcode) sub deletefiletype(filetype) 'set variables for registry access with WMI Const HKEY_CLASSES_ROOT = &H80000000 computer = "." 'create connection to registry Set objReg = GetObject("winmgmts:\\" & computer & "\root\default:StdRegProv") 'read the key that exists objReg.EnumKey HKEY_CLASSES_ROOT,filetype,SubKeyArray 'if key has subkeys then recurse If IsArray(SubKeyArray) Then For Each SubKey In SubKeyArray deletefiletype filetype & "\" & subkey Next End If 'otherwise delete the key objReg.DeleteKey HKEY_CLASSES_ROOT,filetype end sub wscript.quit