Имеется сервис GLPI + плагин FusionInventory(Сервис для учёта и инвентаризации оборудования), полностью рабочий, развёрнут скажем на ip адресе 192.168.8.88.
Написан скрипт vbs который при запуске должен установить FusionAgent на компьютер и через него связываться с сервером и передавать туда данные о ПК. При запуске ничего не происходит... нет ошибок, нет каких-то прочих признаков что скрипт сработал софт при этом не устанавливается, при перезагрузке никаких изменений... Если установить и настроить всё руками, то всё работает как надо, данные на сервер поступают. Пробовал указывать ссылку на установочник не с GitHub а с сетевого диска сразу на exe файл, пробовал разместить exe на своём пк и указать путь, тоже не помогло.
Подскажите в чём может быть проблема?
Скрипт:
SetupVersion = "2.6"
SetupLocation = "https://github.com/fusioninventory/fusioninventory-agent/releases/download/2.6/fusioninventory-agent_windows-x64_2.6.exe"
SetupArchitecture = "Auto"
SetupOptions = "/acceptlicense /runnow /server='http://192.168.8.88/plugins/fusioninventory/' /S"
Setup = "fusioninventory-agent_windows-" & SetupArchitecture & "_" & SetupVersion & ".exe"
Force = "No"
Verbose = "No"
Function AdvanceTime(nMinutes)
Dim nMinimalMinutes, dtmTimeFuture
' As protection
nMinimalMinutes = 5
If nMinutes < nMinimalMinutes Then
nMinutes = nMinimalMinutes
End If
' Add nMinutes to the current time
dtmTimeFuture = DateAdd ("n", nMinutes, Time)
' Format the result value
' The command AT accepts 'HH:MM' values only
AdvanceTime = Hour(dtmTimeFuture) & ":" & Minute(dtmTimeFuture)
End Function
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 GetSystemArchitecture()
Dim strSystemArchitecture
Err.Clear
' Get operative system architecture
On Error Resume Next
strSystemArchitecture = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
If Err.Number = 0 Then
' Check the operative system architecture
Select Case strSystemArchitecture
Case "x86"
' The system architecture is 32-bit
GetSystemArchitecture = "x86"
Case "AMD64"
' The system architecture is 64-bit
GetSystemArchitecture = "x64"
Case Else
' The system architecture is not supported
GetSystemArchitecture = "NotSupported"
End Select
Else
' It has been not possible to get the system architecture
GetSystemArchitecture = "Unknown"
End If
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
Function IsInstallationNeeded(strSetupVersion, strSetupArchitecture, strSystemArchitecture)
Dim strCurrentSetupVersion
' 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
ShowMessage("Installation needed: " & strCurrentSetupVersion & " -> " & strSetupVersion)
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
ShowMessage("Installation needed: " & strCurrentSetupVersion & " -> " & strSetupVersion)
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' doesn't exist
Err.Clear
ShowMessage("Installation needed: " & strSetupVersion)
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
ShowMessage("Installation needed: " & strCurrentSetupVersion & " -> " & strSetupVersion)
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
ShowMessage("Installation needed: " & strCurrentSetupVersion & " -> " & strSetupVersion)
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
ShowMessage("Installation needed: " & strCurrentSetupVersion & " -> " & strSetupVersion)
IsInstallationNeeded = True
End If
Exit Function
Else
' The subkey 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FusionInventory-Agent' doesn't exist
Err.Clear
ShowMessage("Installation needed: " & strSetupVersion)
IsInstallationNeeded = True
End If
End If
End If
End If
End Function
Function IsSelectedForce()
If LCase(Force) <> "no" Then
ShowMessage("Installation forced: " & SetupVersion)
IsSelectedForce = True
Else
IsSelectedForce = False
End If
End Function
' http://www.ericphelps.com/scripting/samples/wget/index.html
Function SaveWebBinary(strSetupLocation, strSetup)
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
Весь код не вместится, продолжение в комментах. извините за неудобства.