/build/static/layout/Breadcrumb_cap_w.png

Vcreds - Powershell

   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

Answers (2)

Posted by: anonymous_9363 7 years ago
Red Belt
2
FWIW,  redists should really be part of your image.
Posted by: rad33k 7 years ago
Fourth Degree Brown Belt
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 :)
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ