Hi, Couple of things. I have to install the pre req's as part of my powershell script. When I try install vcreds via powershell with the recommended switches it does not go silent. Also I would like a pause between each running. Looking on the internet -wait or start-sleep is suggested. -wait doesn't appear to work in this instance.

#Installs VCreds
        Start-Process "\\Share\rollout\Installations\Scripts\Files\Confirm\2010\vcredist_x86.exe"  /passive | Out-Null
        Start-Process "\\Share\rollout\Installations\Scripts\Files\Confirm\2010\vcredist_x64.exe" /passive | Out-Null
        Start-Process "\\Share\rollout\Installations\Scripts\Files\Confirm\2012Update4\vcredist_x86.exe" /passive | Out-Null
        Start-Process "\\Share\rollout\Installations\Scripts\Files\Confirm\2012Update4\vcredist_x64.exe" /passive | Out-Null

Any advice is appreciated 
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2
FWIW,  redists should really be part of your image.
Answered 08/10/2017 by: VBScab
Red Belt

Please log in to comment

Answers

0
As VBScab mentioned it is good to have vcredists added to the core image.
Here are my comments regarding the script:
- Vcredist executable started with /q parameter does not display anything (/passive displays a progress dialog)
-Wait parameter of the Start-Process command is self-explanatory - scripts waits for the command to be completed and then moves to the next line (starts the process synchronously). It does not work if EXE just starts some sub processes and ends before sub processes are finished, but as I remember it is not the case for vcredists executable.
-WindowStyle Hidden - hides the main GUI of the called EXE (It does not hide additional pop-ups started as sub processes etc.)

If you need additional pause between each execution you can use mentioned Start-Sleep (a.k.a. Sleep) cmdlet.

You may also consider some error handling, for example:

$Proc = Start-Process -FilePath "\\Share\rollout\Installations\Scripts\Files\Confirm\2010\vcredist_x86.exe" -ArgumentList "/q /norestart" -Wait -WindowStyle Hidden -PassThru
If (($Proc.ExitCode -eq 0) -or ($Proc.ExitCode -eq 3010)){
    #Success
    #Do Something
}
else{
    #Fail
    #Do something else
}

#Pause script for 2 seconds
Start-Sleep -S 2

....
EDIT: *I forgot about -PassThru attribute :)
Answered 08/22/2017 by: rad33k
Third Degree Green Belt

Please log in to comment
Answer this question or Comment on this question for clarity