locked
SSCM Powershell RRS feed

  • Pregunta

  • Buenos días,

    He creado un script de Powershell (muy básico, no tengo muchos conocimientos) y lo intento distribuir por SCCM.
    El tema es que si lo ejecuto localmente en mi notebook funciona pero por SCCM no:

    No copia archivos, no ejecuta.

    La configuración de SSCM está en ByPass para los scripts, no entiendo el problema.
    Lo dejó aquí pegado por si me pueden dar una ayudita.

    $sourceFiles = '\\XXXX\Sources\Applications\FortiClient\Script'
    $destinationFolder = 'C:\Temp\SCCM\FortiClient'
    Copy-Item  -Path $sourceFiles -Destination $destinationFolder -Recurse -force
    $software = "FortiClient"
    $installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null
    
    ####################################################
    ###################64 bit section###################
    ####################################################
    If (([System.Environment]::Is64BitProcess -and -not $installed)){
      msiexec /i $destinationFolder'\FortiClientx64_7.0.2.0090.msi' /qn /norestart
    reg import $destinationFolder'\VPN.reg'
    } ELSEIF ( ([System.Environment]::Is64BitProcess -and $installed)){
      reg add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v InstallFortiClient7020090 /t REG_EXPAND_SZ /f /d "msiexec /i C:\Temp\SCCM\FortiClient\FortiClientx64_7.0.2.0090.msi /qn /norestart"
       reg add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v FortiClients7020090_REG /t REG_EXPAND_SZ /f /d "reg import C:\Temp\SCCM\FortiClient\VPN.reg"
      $application = Get-WmiObject -Class Win32_Product -Filter "Name = 'FortiClient'"
    $application.Uninstall() 
    }
    
    ####################################################
    ###################32 bit section###################
    ####################################################
    If ((-not [System.Environment]::Is64BitProcess -and -not $installed )){
      msiexec /i $destinationFolder'\FortiClientx86_7.0.2.0090.msi' /qn /norestart
    reg import $destinationFolder'\VPN.reg'
    
    } ELSEIF ((-not [System.Environment]::Is64BitProcess -and $installed)){
      reg add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v InstallFortiClient7020090 /t REG_EXPAND_SZ /f /d "msiexec /i C:\Temp\SCCM\FortiClient\FortiClientx86_7.0.2.0090.msi /qn /norestart"
       reg add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v FortiClients7020090_REG /t REG_EXPAND_SZ /f /d "reg import C:\Temp\SCCM\FortiClient\VPN.reg"
      $application = Get-WmiObject -Class Win32_Product -Filter "Name = 'FortiClient'"
    $application.Uninstall()
    }

    Gracias

    Saludos,

    Tomás Esteban Corey


    • Editado TomasCorey miércoles, 16 de febrero de 2022 9:28
    miércoles, 16 de febrero de 2022 9:27