Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
If (Get-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory Agent" -ErrorAction SilentlyContinue | Where-Object { $_.DisplayVersion -match '2.8.0.0' }) {
Write-EventLog –LogName Application –Source OCS Inventory Service -EntryType Information -EventId 666 -Message "OCS Inventory Agent 2.8.0.0 ist schon installiert."
} Else {
If (Get-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory NG Agent" -ErrorAction SilentlyContinue | Where-Object { $_.DisplayVersion -match '2.8.0.0' }) {
Write-EventLog –LogName Application –Source OCS Inventory Service -EntryType Information -EventId 666 -Message "OCS Inventory 2.8.0.0 x64 Agent ist schon installiert."
} Else {
Start-Process -Wait msiexec -ArgumentList '/i "\\domain.com\sysvol\domain.com\scripts\OCSInventory\OCS-Windows-Agent-Setup_v3.msi" /q' -ErrorAction SilentlyContinue
} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment