Last active
November 29, 2016 14:25
-
-
Save atao/f15e377ac9ee78f2e71668ebe95105cc to your computer and use it in GitHub Desktop.
Script d'installation de l'agent OCS Inventory pour un déploiement via GPO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################## | |
# Installation OCS via GPO # | |
############################## | |
#Auteur : atao | |
#Date : 29/11/2016 | |
#Chemin du fichier d'Installation | |
$executable = "\\[Chemin réseau de l'executable]\OCS-NG-Windows-Agent-Setup.exe" | |
#Récupération de la version du fichier | |
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($executable).FileVersion | |
#Arguments pour l'installation | |
$arguments = "/S /NOSPLASH /SERVER=https://[adresse du glpi].lan/ocsinventory/ /ssl=0 /force /NOW" | |
#Numéro de version si installé | |
$ocs = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion | ? {$_.DisplayName -like "OCS Inventory NG Agent*"} | |
#Lancer OCS | |
$run_ocs = "C:\Program Files (x86)\OCS Inventory Agent\OcsSystray.exe" | |
#Installation | |
if ($ocs.DisplayVersion -ne $version){ | |
Write "Début de l'installation..." | |
Start-Process $executable $arguments | |
While ((Test-Path $run_ocs) -eq $False){ | |
Write "Attente de la fin de l'installation..." | |
sleep(8) | |
} | |
#Lancerment d'OCS | |
Start-Process $run_ocs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment