Automatic installation script without user interaction

Asked

Viewed 6,606 times

4

I need to run the ocsinventory agent installation automatically via script, which will be started by the domain’s GPO, and can be in . bat, . vbs or powershell, and there can be no user interaction. I have read and tested all the literature of the OCS documentation, but without success, because *seems to be outdated. I have already used the methods psexec.exe and msiexec.exe*, but the installation window insists on appearing to the user.

Follow my used code:

ECHO OFF
title *** INSTALACAO ***

START \\server\compartilhamento\ocsinventoryagent.exe /server=https://162.0.0.1/ocsinventory /NOW /NOLICPROMPT /TIMER:0

EXIT

Even with using argument/parameter /NOLICPROMPT, the system window opens and asks if it is to run and asks permission from UAC.

I need to do the installation without pressing the buttons NEXT or SIM and with administrator rights. I have tried to do with the method:

psexec \\* -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory

Unsuccessful too!

  • I managed with the following vbs script: On error resume next 
 
Dim WshShell, fso 
Set WshShell = WScript.CreateObject("WScript.Shell") 
Set fso = CreateObject("Scripting.FileSystemObject") 

WshShell.Run "runas /user:DOMÍNIO\Administrator ""\\162.0.0.1\publico\agenteocs.exe /QUIET /S /NOW """

WScript.Sleep 1500

WshShell.Sendkeys "password~"
 
'Envia senha para o usuário adminstrator'

2 answers

3

Try installing with the command add-ons present in the reply, however, using the installer .exe , since you have available in the installer version .msi, and also the installer .exe for download on www.ocsinventory-ng.org:


inserir a descrição da imagem aqui


inserir a descrição da imagem aqui


::Update based on the latest comments::

I believe I can solve using the complementary information via command, where you will run the installer on the server and informing (all.txt) the client installation target stations:

rem :: informando todos as estacoes == "\\*"
psexec \\* -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory

rem :: informando especificas estacoes == "\\@ALL.TXT*" uma por linha!!
psexec @ALL.TXT -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory

Could use the installation tool msiexec.exe

@echo off & title *** INSTALACAO ***

%windir%\system32\msiexec.exe /i \\server\compartilhamento\pacote.msi /qn 

exit 

Consider giving the name of the program that these installing, since it would be possible to do some tests to obtain information that result in a possible solution.


For example, the program Bginfo.exe (like other Sysinternals programs), accept the argument /nocliprompt and /accepteula /i, this to avoid opening window for acceptance of the terms/license, but when no arguments are passed on any of these options, it will read in the record a key/value, if it finds this key/value, no proposed license acceptance window is displayed:


key with license acceptance value already made:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Sysinternals\BGInfo] 
"EulaAccepted"=dword:00000001

Or via command line/bat :


REG ADD HKCU\Software\Sysinternals\Bginfo.exe /v EulaAccepted /t REG_DWORD /d 1 /f

If applicable, you can add the entry in the record to your bat:

@echo off & title *** INSTALACAO ***

REG ADD HKCU\Software\Sysinternals\Bginfo.exe /v EulaAccepted /t REG_DWORD /d 1 /f

%windir%\system32\msiexec.exe /i \\server\compartilhamento\pacote.msi /qn 

exit
  • Thanks @It Wasn’t Me, in my case the installer is the Ocsinventory agent, it does not ask accepted license, but asks to enter the settings, what I decided commenting /NOW /SERVER=https://162.0.0.1/ocsinventory. The problem is "splashar" on the user screen and effectively install on the client machine.

  • Ocsinventory documentation is outdated :/. This psExec method was my first attempt!!!

  • Well, so far, only the assisted installation, ie, the one that requires clicking on NEXT or SIM buttons has had effect

2


I got it using this script on :


On error resume next 

Dim WshShell, fso 
Set WshShell = WScript.CreateObject("WScript.Shell") 
Set fso = CreateObject("Scripting.FileSystemObject") 

WshShell.Run "runas /user:DOMÍNIO\Administrator ""\\162.0.0.1\publico\ocsagente.exe /QUIET /S /NOW  """

WScript.Sleep 1500
WshShell.Sendkeys "password~"

'Envia senha para o usuário adminstrator'

Installation occurs silently, including on stations with no administrator privileges.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.