Forum Discussion

Beu5-2265's avatar
Beu5-2265
Copper Contributor
Jan 06, 2022
Solved

PowersShell script to install a msi with custom parameters

Hi ! It's my first post in the community hoping to find a solution for this. I am using a script to install an msi that is being pulled from a cloud download location and using powershell to parse t...
  • KarlFasick's avatar
    Jan 10, 2022

    Regardless of method to generate the space delimited string of parameters, output the string to see that it is what you want. I'd step back and do something like this first, read the output string carefully. I took a stab at shuffling some single, doublequote, and spaces, and pulled out one semicolon but don't know if that is right. Also added /qn for Quiet, No GUI.

    Quotes around the msi file name might help if the actual path you have there has spaces in it.

     

    It dumps out this now

     

     

    $ArgumentsMSI
    /i ".\xxxxx.msi" /qn SITEURL=xxx SELECTED_xx_ENVIRONMENT=xxxcom ADMIN_xx_EDITBOX_VALUE=xxx IS_ENCRYPTED=0 LOGOFILE=xxx SSPR_URL=xxx SSO_ENABLED=0 PASSWORD_SYNC_ENABLED=1 TECUNIFY_CHECKBOX_STATE=0 UPS_ENABLED=0 UTM_ENABLED=0 LOCALUSER=1 DOMAINUSER=1 MICROSOFTUSER=1 AZUREUSER=1 PKPENABLE=xx OFFLINE_ENABLED=1 FAILOPEN=0 OFFLINE_MAX_TRIES_LIMIT=5 SELECTED_UAC_OPTION=1 CONTACT_INFO=xxx

     

     

    code (if it lets me post this time)

     

    $DownloadPath = ".\xxxxx.msi"
    
    $ArgumentsMSI ='/i ' + '"' + "$DownloadPath" + '" ' + '/qn ' + 'SITEURL=xxx SELECTED_xx_ENVIRONMENT=xxxcom ADMIN_xx_EDITBOX_VALUE=xxx IS_ENCRYPTED=0 LOGOFILE=xxx SSPR_URL=xxx SSO_ENABLED=0 PASSWORD_SYNC_ENABLED=1 TECUNIFY_CHECKBOX_STATE=0 UPS_ENABLED=0 UTM_ENABLED=0 LOCALUSER=1 DOMAINUSER=1 MICROSOFTUSER=1 AZUREUSER=1 PKPENABLE=xx OFFLINE_ENABLED=1 FAILOPEN=0 OFFLINE_MAX_TRIES_LIMIT=5 SELECTED_UAC_OPTION=1 CONTACT_INFO=xxx'
    
    'Output arguments and verify first'
    Write-Host $ArgumentsMSI
    
    'Only run after verifying output of resulting $ArgumentsMSI first'
    'Start-Process -FilePath "msiexec.exe" -Wait -ArgumentList $ArgumentsMSI'

     

     

     

     

Resources