none
Logic to include passing parameters to powershell script RRS feed

  • Question

  • $current_pc     = "$env:computername"
    $filePath      = "c:\users\Ara\Desktop\parameters.csv"
    $machineParams = Import-CSV $filePath
    $info          = if($machineParams){$machineParams | where {$_.branch -eq $($current_pc.Substring($current_pc.length - 3,3))}}
                     else{write-output "CSV not loaded"}
    $info
    
     Start-Process -FilePath "c:\users\Ara\Desktop\setup.msi"  -ArgumentList “/qf”, "DATABASE_ID=$($info.DATABASE_ID)" , "ODBC_DATABASE_NAME=$($info.ODBC_DATABASE_NAME)" ,  "ODBC_ENGINE_NAME=$($info.ODBC_ENGINE_NAME)" , "ODBC_HOST_NAME=$($info.ODBC_HOST_NAME)" , "COPY_DB_FROM_DIR=$($info.COPY_DB_FROM_DIR)" -wait

    Hello all,

    My above script works good.

    we have parameters file, from where the script take parameters from to install setup.msi, matching the computer name.

    My question is what should i include in the script to give parameters drirectly to script.

    i mean if the script name is install.ps1. if I run install.ps1 -188, it checks the 188 in config file and take the parameters

    Thanks


    EDGE

    • Moved by Bill_Stewart Friday, July 27, 2018 8:42 PM This is not "train me in basics" forum
    Tuesday, May 29, 2018 5:14 PM

All replies