bonjour,
Afin d'utiliser au mieux la 2.3.0 dispo en version x86 et x64, j'ai voulu modifier ma GPO.
en me basant sur le script de ZenAdm, j'ai créé ce script :
Quote:Option Explicit
On Error Resume Next
Dim AvailableVersion, InstalledVersion, FusionArguments, UpdateArguments, FusionSetupExe, WshShell, OSType, InstallCommand, UpdateCommand, InstalledKey
'
' User settings
'
AvailableVersion = "2.3.0"
FusionArguments = "/S /server=http://serveurglpi/glpi/plugins/fusioninventory/ /rpc-trust-localhost /runnow"
UpdateArguments = "/execmode=none"
FusionSetupExe = "fusioninventoryagent.exe"
'
'DO NOT EDIT BELOW
'
Set WshShell = Wscript.CreateObject("Wscript.shell")
' Get OS Type, 32 or 64 bit
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
' Extract installed version from registry
if (OsType = "x86") then
InstalledKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion"
FusionSetupExe = "fusioninventoryagentx86.exe"
else
InstalledKey = "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion"
FusionSetupExe = "fusioninventoryagentx64.exe"
end if
InstallCommand = FusionSetupExe & " " & FusionArguments
UpdateCommand = InstallCommand & " " & UpdateArguments
' Install FusionInventory if not yet installed
' Update FusionInventory if available version is different from installed one
InstalledVersion = WshShell.RegRead(InstalledKey)
if InstalledVersion = "" then
Wscript.Echo "FusionInventory not installed, installing version " & AvailableVersion
Wscript.Echo "Running command: " & InstallCommand
WshShell.Run "CMD.EXE /C """ & InstallCommand & """",0,True
elseif InstalledVersion <> AvailableVersion then
Wscript.Echo "Installed version: " & InstalledVersion & " - New version available: " & AvailableVersion
Wscript.Echo "Running command: " & UpdateCommand
WshShell.Run "CMD.EXE /C """ & UpdateCommand & """",0,True
else
Wscript.Echo "Current version " & InstalledVersion & " is up to date"
end if
avec une GPO qui fonction avec mon ancien script et une seule version de fichier exe.
Il semble que la version 2.3.0 ne soit pas compatible avec ce type de script aussi bien la version x86 que la x64.
Même en utilisant la ligne de commande en direct, rien ne se passe. L'exe n'apparait pas dans le gestionnaire de tache.
Exemple de ligne de commande construit par le script :
fusioninventoryagentx64.exe /S /server=http://server/glpi/plugins/fusioninventory/ /rpc-trust-localhost /runnow
Cela ne fonctionne pas.
si je place une version 2.2.7-4 à la place cela fonctionne.
De plus il semble qu'au niveau registre pour la version 64 (non testé avec la 32) cela ne place pas les infos dans le noeud "Wow6432Node" car en installant à la main le x64 pour vérifier que l'exe fonctionne et en utilisant le script ensuite, il m'indique qu'aucune version n'est installée.
Des idées sur comment modifier le script pour la 2.3.0?
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
Meldrone,
J'ai déjà créer un post sur ce sujet
Merci aux admin de fusionner mon post avec celui ci
@+
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
Bonjour mips,
Où est le second post ?
bonjour,
sauf erreur le second post est juste une demande de mise à jour de la page du script et c'est dans la section anglais et on français.
Au final je ne pense pas que cela soit tout a fait le même type de post.
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
Hello,
Je voudrais importer le VBS dans le dossier contrib du dépôt git de l'agent. Il y a un VBS qui marche bien aujourd'hui avec la 2.3.0 ?
pas à ma connaissance.
Je suppose que ce sont les paramètres envoyés qui ont changé mais je n'ai pas eu le temps de trouvé la nouvelle liste de paramètre et de l'ancienne pour les comparer.
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
je viens de regarder ces pages :
version 2.2.x
http://www.fusioninventory.org/documenta...ory-agent/
version 2.3.x
http://www.fusioninventory.org/documenta...ory-agent/
Dans les deux cas je ne retrouve pas certains paramètre comme "/rpc-trust-localhost" ou "/runnow"
je pense que je ne regarde pas vraiment sur la bonne page.
Où puis trouver la liste des paramètres pour l'exe d'install de l'agent?
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
petit résumé sur l'avancée de mes recherches :
contrairement aux anciennes versions, le /server nécessite un chemin entre ""
de plus il faut ajouter le paramètre /acceptlicense si utilisation du mode /S
Pour finir le paramètre /rpc-trust-localhost n'existe plus et bloc le scipt si laissé.
Ne sachant pas ce à quoi il servait avant je ne sais pas par quoi le remplacer.
les tests ont été fait sur un poste en windows 7 32bits.
Il semble que la clé niveau registre se nomme
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent\DisplayVersion
et non
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion
La différence étant sur le "-" au lieu d'un " "
A modifier dans le script sinon il ne remarque pas que l'outil est déjà installé
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
pour la partie registre, soit on laisse "FusionInventory Agent" et il comprend que c'est une mise à jour la première fois mais il faudra penser à changer le script plus tard car la clé est modifié en "FusionInventory-Agent" soit on met tout de suite "FusionInventory-Agent".
A voir si c'est une erreur coté prog ou si cela restera comme cela.
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
2013-08-12, 12:04:43
(This post was last modified: 2013-08-12, 12:06:01 by meldrone.)
voici une version de mon script qui fonctionne (mise à part le petit soucis de chemin registre pour la vérification :
Quote:Option Explicit
On Error Resume Next
Dim AvailableVersion, InstalledVersion, FusionArguments, UpdateArguments, FusionSetupExe, WshShell, OSType, InstallCommand, UpdateCommand, InstalledKey
'
' User settings
'
AvailableVersion = "2.3.0"
FusionArguments = "/S /acceptlicense /server=""http://serveurglpi/glpi/plugins/fusioninventory/"" /runnow"
UpdateArguments = "/execmode=none"
FusionSetupExe = "fusioninventoryagent.exe"
'
'DO NOT EDIT BELOW
'0
Set WshShell = Wscript.CreateObject("Wscript.shell")
' Get OS Type, 32 or 64 bit
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
' Extract installed version from registry
if (OsType = "x86") then
'anciennement : InstalledKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion"
InstalledKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent\DisplayVersion"
FusionSetupExe = "fusioninventoryagentx86.exe"
else
'anciennement : InstalledKey = "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion"
InstalledKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent\DisplayVersion"
FusionSetupExe = "fusioninventoryagentx64.exe"
end if
InstallCommand = FusionSetupExe & " " & FusionArguments
UpdateCommand = InstallCommand & " " & UpdateArguments
' Install FusionInventory if not yet installed
' Update FusionInventory if available version is different from installed one
InstalledVersion = WshShell.RegRead(InstalledKey)
if InstalledVersion = "" then
'Wscript.Echo "FusionInventory not installed, installing version " & AvailableVersion
'Wscript.Echo "Running command: " & InstallCommand
WshShell.Run "CMD.EXE /C """ & InstallCommand & """",0,True
elseif InstalledVersion <> AvailableVersion then
'Wscript.Echo "Installed version: " & InstalledVersion & " - New version available: " & AvailableVersion
'Wscript.Echo "Running command: " & UpdateCommand
WshShell.Run "CMD.EXE /C """ & UpdateCommand & """",0,True
else
'Wscript.Echo "Current version " & InstalledVersion & " is up to date"
end if
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
2013-08-13, 07:09:01
(This post was last modified: 2013-08-13, 07:12:51 by mips.)
J'ai réaliser une adaptation
Code: Option Explicit
Dim versionverification, fusionarguments, uninstallocsagent, fusionsetupURL, OSType
''''' USER SETTINGS '''''
versionverification = "2.3.0"
fusionarguments = "/S /acceptlicense /server=""https://glpi/glpi/plugins/fusioninventory/"" /runnow /no-ssl-check /add-firewall-exception /execmode=service /installtype=from-scratch"
' Depending on your needs, you can use either HTTP or Windows share
'fusionsetupURL = "\\server1\data\fusioninventory-agent_windows-i386_" & versionverification & ".exe"
fusionsetupURL = "http://forge.fusioninventory.org/attachments/download/1020/fusioninventory-agent_windows-"& OsType & "_" & versionverification & ".exe"
uninstallocsagent = "yes"
''''' DO NOT EDIT BELOW '''''
Function baseName (strng)
Dim regEx, ret
Set regEx = New RegExp
regEx.Global = true
regEx.IgnoreCase = True
regEx.Pattern = ".*[/\\]([^/\\]+)$"
baseName = regEx.Replace(strng,"$1")
End Function
Function isHttp (strng)
Dim regEx, matches
Set regEx = New RegExp
regEx.Global = true
regEx.IgnoreCase = True
regEx.Pattern = "^(http(s?)).*"
If regEx.Execute(strng).count > 0 Then
isHttp = True
Else
isHttp = False
End If
Exit Function
End Function
' http://www.ericphelps.com/scripting/samples/wget/index.html
Function SaveWebBinary(strUrl) 'As Boolean
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const ForWriting = 2
Dim web, varByteArray, strData, strBuffer, lngCounter, ado
' On Error Resume Next
'Download the file with any available object
Err.Clear
Set web = Nothing
Set web = CreateObject("WinHttp.WinHttpRequest.5.1")
If web Is Nothing Then Set web = CreateObject("WinHttp.WinHttpRequest")
If web Is Nothing Then Set web = CreateObject("MSXML2.ServerXMLHTTP")
If web Is Nothing Then Set web = CreateObject("Microsoft.XMLHTTP")
web.Open "GET", strURL, False
web.Send
If Err.Number <> 0 Then
SaveWebBinary = False
Set web = Nothing
Exit Function
End If
If web.Status <> "200" Then
SaveWebBinary = False
Set web = Nothing
Exit Function
End If
varByteArray = web.ResponseBody
Set web = Nothing
'Now save the file with any available method
On Error Resume Next
Set ado = Nothing
Set ado = CreateObject("ADODB.Stream")
If ado Is Nothing Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(baseName(strUrl), ForWriting, True)
strData = ""
strBuffer = ""
For lngCounter = 0 to UBound(varByteArray)
ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))
Next
ts.Close
Else
ado.Type = adTypeBinary
ado.Open
ado.Write varByteArray
ado.SaveToFile CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%") & "\fusioninventory.exe", adSaveCreateOverWrite
ado.Close
End If
SaveWebBinary = True
End Function
Function removeOCS()
On error resume next
Dim OCS
' Uninstall agent ocs if is installed
' Verification on OS 32 Bits
On error resume next
OCS = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory Agent\UninstallString")
If err.number = 0 then
WshShell.Run "CMD.EXE /C net stop ""OCS INVENTORY SERVICE""",0,True
WshShell.Run "CMD.EXE /C """ & OCS & """ /S /NOSPLASH",0,True
WshShell.Run "CMD.EXE /C rmdir ""%ProgramFiles%\OCS Inventory Agent"" /S /Q",0,True
WshShell.Run "CMD.EXE /C rmdir ""%SystemDrive%\ocs-ng"" /S /Q",0,True
WshShell.Run "CMD.EXE /C sc delete ""OCS INVENTORY""",0,True
End If
' Verification on OS 64 Bits
On error resume next
OCS = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory Agent\UninstallString")
If err.number = 0 then
WshShell.Run "CMD.EXE /C net stop ""OCS INVENTORY SERVICE""",0,True
WshShell.Run "CMD.EXE /C """ & OCS & """ /S /NOSPLASH",0,True
WshShell.Run "CMD.EXE /C rmdir ""%ProgramFiles(x86)%\OCS Inventory Agent"" /S /Q",0,True
WshShell.Run "CMD.EXE /C rmdir ""%SystemDrive%\ocs-ng"" /S /Q",0,True
WshShell.Run "CMD.EXE /C sc delete ""OCS INVENTORY""",0,True
End If
' Verification Agent V2 on 32Bit
On error resume next
OCS = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory NG Agent\UninstallString")
If err.number = 0 then
WshShell.Run "CMD.EXE /C net stop ""OCS INVENTORY SERVICE""",0,True
WshShell.Run "CMD.EXE /C taskkill /F /IM ocssystray.exe",0,True
WshShell.Run "CMD.EXE /C """ & OCS & """ /S /NOSPLASH",0,True
WshShell.Run "CMD.EXE /C rmdir ""%ProgramFiles%\OCS Inventory Agent"" /S /Q",0,True
WshShell.Run "CMD.EXE /C rmdir ""%SystemDrive%\ocs-ng"" /S /Q",0,True
WshShell.Run "CMD.EXE /C sc delete ""OCS INVENTORY""",0,True
End If
' Verification Agent V2 on 64Bit
On error resume next
OCS = WshShell.RegRead("HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory NG Agent\UninstallString")
If err.number = 0 then
WshShell.Run "CMD.EXE /C net stop ""OCS INVENTORY SERVICE""",0,True
WshShell.Run "CMD.EXE /C taskkill /F /IM ocssystray.exe",0,True
WshShell.Run "CMD.EXE /C """ & OCS & """ /S /NOSPLASH",0,True
WshShell.Run "CMD.EXE /C rmdir ""%ProgramFiles%\OCS Inventory Agent"" /S /Q",0,True
WshShell.Run "CMD.EXE /C rmdir ""%SystemDrive%\ocs-ng"" /S /Q",0,True
WshShell.Run "CMD.EXE /C sc delete ""OCS INVENTORY""",0,True
End If
End Function
Function needFusionInstall ()
Dim Fusion
' install fusion if version is different or if not installed
needFusionInstall = False
On error resume next
Fusion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion")
If err.number = 0 Then
' Verification on OS 32 Bits
If Fusion <> versionverification Then
needFusionInstall = True
Else
needFusionInstall = False
Return
End If
Else
' Verification on OS 64 Bits
On error resume next
Fusion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion")
If err.number = 0 Then
If Fusion <> versionverification Then
needFusionInstall = True
End if
Else
needFusionInstall = True
End If
End If
End Function
''' MAIN
Dim WshShell
Set WshShell = Wscript.CreateObject("Wscript.shell")
' Get OS Type, 32 or 64 bit
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
If uninstallocsagent = "yes" Then
removeOCS()
End If
If needFusionInstall() Then
If (isHttp(fusionsetupURL)) Then
SaveWebBinary(fusionsetupURL)
WshShell.Run "CMD.EXE /C %TEMP%\fusioninventory.exe " & fusionarguments,0,True
Else
WshShell.Run "CMD.EXE /C """ & fusionsetupURL & """ " & fusionarguments,0,True
End If
End If
merci de confirmer que cette version est fonctionnelle.
@+
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
2013-08-13, 07:36:08
(This post was last modified: 2013-08-13, 08:02:14 by mips.)
Je propose faire une TODOLIST
TODOLIST:
- Add log files
- Add MD5 check to file dowloaded
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
Bonjour mips, n'ayant plus de client OCS depuis un moment et n'utilisant pas le téléchargement des sources en direct lors du déploiement, je ne peux pas tester ton script.
Pour les devs, concernant la gestion des clé registre, est ce définitif? (la partie "Wow6432Node" qui saute et l'espace qui est remplacé par un "-" dans le nom "FusionInventory Agent"
cela a son importance pour les futur version et la vérification de version
GLPI 9.2.1 sous Ubuntu 16.04 LTS
FUSIONINVENTORY for GLPI 9.1+1.0
FUSIONINVENTORY Agent windows 2.3.21
FUSIONINVENTORY Agent ubuntu
Il faudrait ajouter la detection des clef avec un «-». Cela permetra de detecter un seuil de version de l'agent (inferieur ou egal à 2.2.7-4)
j'ose esperer que quelqu'un y fera cet ajout.
@+
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
On est en train de regarder ce soucis de tiret
Les modèles ADMX sont avec le «-».
le garder serais une bonne chose pour des raisons de simplification de devellopement (scripting, etc…)
@+
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
oui oui c'est justement ce qu'on souhaite également
( c.f: http://forum.fusioninventory.org/viewtop...?pid=12480 )
Je viens d'importer ce script dans le dépôt git de l'agent :
https://github.com/fusinv/fusioninventor...ib/windows
J'ai fait ça car ça devenait vraiment compliquer de trouver la version de référence. Je le supprimerai du Wiki dans quelques jours  . Donc je vous invite a faire des patches par rapport à la version Git maintenant \o/
2013-08-15, 01:56:40
(This post was last modified: 2013-08-16, 06:50:29 by tabad.)
Hello,
Here you have my little contribution. I think it resolves the problems with the new installer, while maintaining compatibility with the previous one.
Ah! I need some information to complete the head of this file.
I have left the patch in GitHub.
Code: '
' ------------------------------------------------------------------------
' fusioninventory-agent-deployment.vbs
' Copyright (C) 2010-2013 by the FusionInventory Development Team.
'
' http://www.fusioninventory.org/ http://forge.fusioninventory.org/
' ------------------------------------------------------------------------
'
' LICENSE
'
' This file is part of FusionInventory project.
'
' This file is free software; you can redistribute it and/or modify it
' under the terms of the GNU General Public License as published by the
' Free Software Foundation; either version 2 of the License, or (at your
' option) any later version.
'
'
' This file is distributed in the hope that it will be useful, but WITHOUT
' ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
' FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
' more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software Foundation,
' Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA,
' or see <http://www.gnu.org/licenses/>.
'
' ------------------------------------------------------------------------
'
' @package FusionInventory Agent
' @file .\contrib\windows\fusioninventory-agent-deployment.vbs
' @author(s) mips
' meldrone
' ZenAdm
' Tomas Abad <tabadgp@gmail.com>
' @copyright Copyright (c) 2010-2013 FusionInventory Team
' @license GNU GPL version 2 or (at your option) any later version
' http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
' @link http://www.fusioninventory.org/
' @link http://forge.fusioninventory.org/projects/fusioninventory-agent
' @since 2012
'
' ------------------------------------------------------------------------
'
'
'
' Purpose:
' FusionInventory Agent Unatended Deployment.
'
'
Option Explicit
Dim Setup, SetupArchitecture, SetupLocation, SetupOptions, SetupVersion, SetupVerbose
'
'
' USER SETTINGS
'
'
' SetupLocation
' Depending on your needs or your environment, you can use either a HTTP or CIFS/SMB.
' If you use HTTP, please, set to SetupLocation a URL:
'
' SetupLocation = "http://host[:port]/[absolut_path]" or
' SetupLocation = "https://host[:port]/[absolut_path]"
'
' If you use CIFS, please, set to SetupLocation a UNC path name:
'
' SetupLocation = "\\host\share\[path]"
'
SetupLocation = "http://forge.fusioninventory.org/attachments/download/1034"
' SetupVersion
' Setup version with the pattern <major>.<minor>.<release>[-<package>]
'
SetupVersion = "2.3.0-1"
' SetupArchitecture
' The setup architecture can be 'i386', 'x86' or 'x64'.
'
' If SetupVersion is 2.2.x (or previous) you must use 'i386' exclusively.
' If SetupVersion is 2.3.x (or later) you can use 'x86' or 'x64', but not 'i386'.
'
SetupArchitecture = "x64"
' SetupOptions
' Consult the installer documentation to know its list of options.
'
SetupOptions = "/acceptlicense /runnow /server='http://<server>/glpi/plugins/fusioninventory/' /S"
' Setup
' The installer file name. You should not have to modify this variable ever.
'
Setup = "fusioninventory-agent_windows-" & SetupArchitecture & "_" & SetupVersion & ".exe"
' SetupVerbose
' Enable or disable the information messages.
'
' It's advisable to use SetupVerbose = "Yes" with 'cscript'.
'
SetupVerbose = "No"
'
'
' DO NOT EDIT BELOW
'
'
Function baseName (strng)
Dim regEx, ret
Set regEx = New RegExp
regEx.Global = true
regEx.IgnoreCase = True
regEx.Pattern = ".*[/\\]([^/\\]+)$"
baseName = regEx.Replace(strng,"$1")
End Function
Function isHttp (strng)
Dim regEx, matches
Set regEx = New RegExp
regEx.Global = true
regEx.IgnoreCase = True
regEx.Pattern = "^(http(s?)).*"
If regEx.Execute(strng).count > 0 Then
isHttp = True
Else
isHttp = False
End If
Exit Function
End Function
' http://www.ericphelps.com/scripting/samples/wget/index.html
Function SaveWebBinary (strSetupLocation, strSetup) 'As Boolean
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const ForWriting = 2
Dim web, varByteArray, strData, strBuffer, lngCounter, ado, strUrl
strUrl = strSetupLocation & "/" & strSetup
'On Error Resume Next
'Download the file with any available object
Err.Clear
Set web = Nothing
Set web = CreateObject("WinHttp.WinHttpRequest.5.1")
If web Is Nothing Then Set web = CreateObject("WinHttp.WinHttpRequest")
If web Is Nothing Then Set web = CreateObject("MSXML2.ServerXMLHTTP")
If web Is Nothing Then Set web = CreateObject("Microsoft.XMLHTTP")
web.Open "GET", strURL, False
web.Send
If Err.Number <> 0 Then
SaveWebBinary = False
Set web = Nothing
Exit Function
End If
If web.Status <> "200" Then
SaveWebBinary = False
Set web = Nothing
Exit Function
End If
varByteArray = web.ResponseBody
Set web = Nothing
'Now save the file with any available method
On Error Resume Next
Set ado = Nothing
Set ado = CreateObject("ADODB.Stream")
If ado Is Nothing Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(baseName(strUrl), ForWriting, True)
strData = ""
strBuffer = ""
For lngCounter = 0 to UBound(varByteArray)
ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))
Next
ts.Close
Else
ado.Type = adTypeBinary
ado.Open
ado.Write varByteArray
ado.SaveToFile CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%") & "\" & strSetup, adSaveCreateOverWrite
ado.Close
End If
SaveWebBinary = True
End Function
Function IsInstallationNeeded (strSetupVersion, strSetupArchitecture)
Dim strSystemArchitecture, strCurrentSetupVersion
' Set the default value
IsInstallationNeeded = False
' Get operative system architecture
' It can be 'x86', 'AMD64' or 'x64'
strSystemArchitecture = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
' Check the operative system architecture
If strSystemArchitecture = "x86" Then
' The system architecture is 32-bit
ElseIf strSystemArchitecture = "x64" Then
' The system architecture is 64-bit, but is IA64
Exit Function
ElseIf strSystemArchitecture = "AMD64" Then
' The system architecture is 64-bit
strSystemArchitecture = "x64"
Else
' The system architecture is unknow
Exit Function
End If
If SetupVerbose <> "No" Then
Wscript.Echo "System Architecture Detected... '" & strSystemArchitecture & "'"
End If
' Check the relation between strSystemArchitecture and strSetupArchitecture
If (strSystemArchitecture = "x86") And (strSetupArchitecture = "x64") Then
' It isn't possible to install a 64-bit setup on a 32-bit operative system
If SetupVerbose <> "No" Then
Wscript.Echo "It isn't possible to install a 64-bit setup on a 32-bit operative system."
End If
Exit Function
End If
' Compare the current version, whether it exists, with strSetupVersion
If strSystemArchitecture = "x86" Then
' The system architecture is 32-bit
' Check if the subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent' exists
' This subkey is now deprecated
On error resume next
strCurrentSetupVersion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion")
If Err.Number = 0 Then
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent' exists
If strCurrentSetupVersion <> strSetupVersion Then
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strCurrentSetupVersion & "' -> '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent' doesn't exist
Err.Clear
' Check if the subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' exists
On error resume next
strCurrentSetupVersion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent\DisplayVersion")
If Err.Number = 0 Then
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' exists
If strCurrentSetupVersion <> strSetupVersion Then
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strCurrentSetupVersion & "' -> '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' doesn't exist
Err.Clear
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
End If
Else
' The system architecture is 64-bit
' Check if the subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent' exists
' This subkey is now deprecated
On error resume next
strCurrentSetupVersion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent\DisplayVersion")
If Err.Number = 0 Then
' The subkey 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent' exists
If strCurrentSetupVersion <> strSetupVersion Then
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strCurrentSetupVersion & "' -> '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory Agent' doesn't exist
Err.Clear
' Check if the subkey 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' exists
On error resume next
strCurrentSetupVersion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent\DisplayVersion")
If Err.Number = 0 Then
' The subkey 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' exists
If strCurrentSetupVersion <> strSetupVersion Then
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strCurrentSetupVersion & "' -> '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' doesn't exist
Err.Clear
' Check if the subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' exists
On error resume next
strCurrentSetupVersion = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent\DisplayVersion")
If Err.Number = 0 Then
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' exists
If strCurrentSetupVersion <> strSetupVersion Then
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strCurrentSetupVersion & "' -> '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' doesn't exist
Err.Clear
If SetupVerbose <> "No" Then
Wscript.Echo "Installation needed: '" & strSetupVersion & "'"
End If
IsInstallationNeeded = True
End If
End If
End If
End If
End Function
'
'
' MAIN
'
'
Dim WshShell
Set WshShell = Wscript.CreateObject("Wscript.shell")
If IsInstallationNeeded(SetupVersion, SetupArchitecture) Then
If isHttp(SetupLocation) Then
If SetupVerbose <> "No" Then
Wscript.Echo "Downloading '" & SetupLocation & "/" & Setup & "'..."
End If
If SaveWebBinary(SetupLocation, Setup) Then
If SetupVerbose <> "No" Then
Wscript.Echo "Running: ""%TEMP%\" & Setup & """ " & SetupOptions
End If
WshShell.Run "CMD.EXE /C ""%TEMP%\" & Setup & """ " & SetupOptions, 0, True
Else
If SetupVerbose <> "No" Then
Wscript.Echo "Error downloading '" & SetupLocation & "\" & Setup & "'!"
End If
End If
Else
If SetupVerbose <> "No" Then
Wscript.Echo "Running: """ & SetupLocation & "\" & Setup & """ " & SetupOptions
End If
WshShell.Run "CMD.EXE /C """ & SetupLocation & "\" & Setup & """ " & SetupOptions, 0, True
End If
Else
If SetupVerbose <> "No" Then
Wscript.Echo "It isn't needed (or possible) the installation of '" & Setup & "'."
End If
End If
Tomás Abad
2013-08-15, 16:39:40
(This post was last modified: 2013-08-15, 16:41:46 by lee.)
J'ai teste le script avec qques modifications
j'ai rajouté 2 variables setup32 et setup64
Mes fichiers sont en partage sur une machine (pas de http..)
j'ai modifié
SetupArchitecture = "xxx"
J'ai rajouté les deux lignes
Setup32 = "fusioninventory-agent_windows-x86_" & SetupVersion & ".exe"
Setup64 = "fusioninventory-agent_windows-x64_" & SetupVersion & ".exe"
Dans le pavé
If strSystemArchitecture = "x86" Then ...
La ou il y a les lignes
IsInstallationNeeded = True
je rajoute la ligne
setup = setup32
(il y a trois a ajouté)
Idem pour le pavé x64
la ligne est
setup = setup64
'il y en a quatres)
Merci a Tabad
PS la version 2.3.0-1 affiche dans glpi Agent 2.3.0
Merci
GLPI 0.90.5/ Plugins Fusion : 090+1.4 / Agent : 2.3.18 < Serveur Centos 64 Bits>
Salut lee,
Merci pour tes retours. Afin qu'on utilise le même outil tous, peux-tu plutôt répondre plutôt sur le lien github qu'a donné Tabad. Pour info, Tabad ne parle pas français  .
2013-08-15, 18:41:34
(This post was last modified: 2013-08-15, 18:44:38 by lee.)
Je crois qu'il faut un loggin ...
et mon anglais n'est pas si extra que ca.....
Peux tu le faire pour moi si cela est nécéssaire ...
Il n'y a plus dans "programmes " l'icone "fusion status" ..
c'est dommage car c'est plus facile de demander à un utilisateur de
cliquer sur l'icone , que de faire http://localhost:62354 ..
Merci
Merci
GLPI 0.90.5/ Plugins Fusion : 090+1.4 / Agent : 2.3.18 < Serveur Centos 64 Bits>
Hi lee,
lee Wrote:Il n'y a plus dans "programmes " l'icone "fusion status" ..
c'est dommage car c'est plus facile de demander à un utilisateur de
cliquer sur l'icone , que de faire http://localhost:62354 ..
Yes, you are right. It's under construction. Sorry.
I have fixed the previous link to GitHub.
One more thing...
I don't understand a lot your changes. Could you attach a complet fragment of your changes, please?
Thanks in advace
Tomás Abad
2013-08-16, 11:35:11
(This post was last modified: 2013-08-16, 11:52:54 by mips.)
Il faut ajouter le détection de l'architecture pour le mode auto
Il y a la base de registre ou la variable system comme ci-dessous.
http://i.snag.gy/y4HQf.jpg
Pour ma part, j'ai un parc heterogene coté architecture. Donc, je suis obliger d'avoir le mode auto.
Il va falloir travailler a ajouter le mode autodetect.
/************
*
* For Tabad
*
\
Must be added the detection architecture for the auto mode
It is the registry or system variable as below.
http://i.snag.gy/y4HQf.jpg
For my part, I park next to a heterogeneous architecture. So I'm forced to have the auto mode.
It will take work to add autodetect mode.
@+
Edit:
Je donne une ligne de code .NET
Code: string arch = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE",
EnvironmentVariableTarget.Machine);
PS: Je m'inscrit a GIT
- EyesOfNetworks 3.0 (CentOS) & XenServer x64 6.1
- glpi 0.84.80
- fusioninventory-for-glpi- 0.84+3.2
- fusioninventory-agent_2.3.15
|