Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.6 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

About the deploy with vbs

Hi ,

I'm new for the OCS inventory NG, and i just installed the server on a windows, and try build a package, which include the 7z 32 & 64 bit msi, a powershell script and a vbs that used for run the powershell.

the package was success build and return the exit code 1. below is the download log VBS and the powershell .and also i have tested the VBS and the PS can install the the 7z.

=============================================Download Log

       DOWNLOAD => Processing packages for cycle 8 on Tuesday, September 20, 2016 10:43:51
    DOWNLOAD => Pausing for cycle latency (5 seconds)
    DOWNLOAD => Processing packages for cycle 9 on Tuesday, September 20, 2016 10:43:56
    DOWNLOAD => Pausing for cycle latency (5 seconds)
    DOWNLOAD => Processing packages for cycle 10 on Tuesday, September 20, 2016 10:44:01
DOWNLOAD => Building package <1474339320>
    PACKAGE => Verifying fragment files of package <1474339320>
    PACKAGE => Checking free disk space for package <1474339320>
    PACKAGE => Building ZIP for package <1474339320>
    PACKAGE => Verifying ZIP signature for package <1474339320>
    DOWNLOAD => Package <1474339320> built successfully
DOWNLOAD => Executing action <LAUNCH> for package <1474339320>
    PACKAGE => Launching command <install.vbs> for package <1474339320> on <Tuesday, September 20, 2016 10:44:01>
    PACKAGE => Package <1474339320> successfully launched. Command exit code is <1>. Package return code is <EXIT_CODE_1>
    PACKAGE => No post execution command provided for package <1474339320>
ERROR *** DOWNLOAD => Will not register package <1474339320> in history: result <EXIT_CODE_1> not a success
DOWNLOAD => Sending result code <EXIT_CODE_1> for package <1474339320>
    DID_CHECK => Read DeviceID <TESTING-PC-2016-09-12-09-59-26> and MACs <F0:DE:F1:37:FF:4058:94:6B:90:6A:3458:94:6B:90:6A:3558:94:6B:90:6A:355C:AC:4C:C2:6F:B9> in file <ocsinventory.dat>
    COM SERVER => Initializing cURL library for sendRequest
    COM SERVER => Using cURL without server authentication
    COM SERVER => Disabling cURL proxy support
    COM SERVER => Disabling cURL SSL server validation support
    COM SERVER => Sending HTTP Post request to URL <http://tpfshk1/ocsinventory>
    COM SERVER => HTTP Post response received <HTTP Status Code #200>
    COM SERVER => Cleaning cURL library
    DOWNLOAD => Result code request successfully sent
    DOWNLOAD => Pausing for fragment latency (10 seconds)
    DOWNLOAD => Pausing for cycle latency (5 seconds)
    DOWNLOAD => Pausing for period latency (10 seconds)
DOWNLOAD => Starting new period of 10 cycles
    DOWNLOAD => Flushing package queue
DOWNLOAD => Parsing directory <C:\ProgramData\OCS Inventory NG\Agent\download> for packages
DOWNLOAD => No package found, exiting
DOWNLOAD => Unloading communication provider
DOWNLOAD => Execution duration: 00:01:27.

=====================================VBS

Dim objShell
Set objShell = Wscript.CreateObject ("Wscript.Shell")
   objShell.Run "cmd /c powershell -noprofile -executionpolicy bypass -file install.ps1"

====================================powershell

$Software = "7-Zip"
$Version = "9.20.00.0"

    #Check the OS Architecture and install 32bit or 64bit
    $oscheck = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
    #Check Remote PC installed and Version for 32bits OS
    If ($oscheck -eq '32-bit')
        {   
            
            #Get the List of Installed Sofrtware(DisplayName and DisplayVersion) for 32bits
            $SWNames = Invoke-command {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName}
            $SWVersion = Invoke-command {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayVersion}
            foreach($SWName in $SWNames)
                {
                    #Check if 7-Zip in List
                    if( $SWName -match $Software)
                        {
                            #Get the 7-Zip Version
                            $PVersion = $SWVersion[[array]::IndexOf($SWNames,$SWName)]
                        }
                }
            #Check if Previous Version not current or empty
            if(!$PVersion -or $PVersion -notmatch $Version)
                {
                    #uninstall the old version and Install 7z
                    if ($PVersion -notmatch $Version -and $PVersion)
                        {
                            $app = Get-WmiObject win32_product | Where-Object {$_.name -match $Software}
                            $SUID = $app.identifyingNumber
                            msiexec.exe /x "$SUID" /quiet /norestart
                            msiexec.exe /i 7z920.msi /quiet /norestart
                        }
                    else
                    #Install 7z
                        {
                            msiexec.exe /i 7z920.msi /quiet /norestart
                        }
                        
                }
        }
    else
        {
            
            #Get the List of Installed Software(DisplayName and DisplayVersion) for 64bits    
            $SWNames = Invoke-command {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName}
            $SWVersion = Invoke-command {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayVersion}
            $SWNames += Invoke-command {Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName}
            $SWVersion += Invoke-command {Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayVersion}
            foreach($SWName in $SWNames)
                {
                    #Check if 7-Zip in List
                    if( $SWName -match $Software)
                        {
                            $PVersion = $SWVersion[[array]::IndexOf($SWNames,$SWName)]
                        }
                }
            #Check if Previous Version not current or empty
            if(!$PVersion -or $PVersion -notmatch $Version)
                {
                    #uninstall the old version and Install
                    if ($PVersion -notmatch $Version)
                        {
                            $app = Get-WmiObject win32_product | Where-Object {$_.name -match $Software}
                            $SUID = $app.identifyingNumber
                            msiexec.exe /x "$SUID" /quiet /norestart
                            msiexec.exe /i 7z920-x64.msi /quiet /norestart
                          
                        }
                    else
                    #Install 7z
                        {
                            msiexec.exe /i 7z920-x64.msi /quiet /norestart
                        }
                        
                }
        }

==============================================END
in OCS Inventory NG server for Windows by (190 points)

2 Answers

0 votes
 
Best answer
Hi,

Which command have you set in your package with the launch method?

Regards

Frank
by (70.3k points)
selected by
0 votes
Hi,

What is the problem? Please explain.

Regards

Frank
by (70.3k points)
Hi Frank,

I Launch a vbs to run a powershell script in a package and It show the Exit_Code_1 and the 7z not installed on the testing-PC via the OCS deployment.

Thanks,

Steven
 
Powered by Question2Answer
...