none
Start-Process starting executable slow RRS feed

  • General discussion

  • I have a script I am using a start process to run a silent install of a product.

    It seems to fire off very slowly, takes about 40 seconds.  If i just execute the command at the command line prompt it will go within 3 seconds.

    My code has variables it is putting together to get all the correct syntax.  Code is below.

    If I run the code I have all the variables defined at the beginning.  I can issue a Write-Host after I exit and all the variables come back correct, but.....the $argies variable comes back blank.  Even though that variable comes back blank when the executable does fire off it has all the information from the variable in the screens.

    Not sure why it takes almost 40 seconds to execute with Start-Process. 

    Any clues from anyone ?

    function Show-Menu
    {
         param (
               [string]$Title = 'VDA Server Setup'
         )
         cls
         Write-Host "================ $Title ================" -foregroundcolor "Green"
    	 Write-Host
    	 Write-Host "**************** $farm *****************" -ForegroundColor "red" -backgroundcolor "yellow"
         Write-Host
         Write-Host "1: Press '1' to Execute Installation." -foregroundcolor "Green"
         Write-Host "Q: Press 'Q' to quit." -foregroundcolor "Green"
         Write-Host
    }
    
    $controller1 = ' "ServerName1'
    $controller2 = ' ServerName2"'
    #Space at beginning of $controller2 is required
    $dpath = "c:\source\"
    $vdaexe = $dpath + 'VDAServerSetup_7_15_1000.exe'
    $argies = '/noreboot /components vda /enable_hdx_ports /enable_real_time_transport /optimize /controllers' + $controller1 + $controller2
    
    
    cls
    
    do
    {
         Show-Menu
         $input = Read-Host "Please make a selection:"
         switch ($input)
         {
               '1' {
                    Write-Host
    				$confirmation = Read-Host 'Are you Sure You Want To Proceed (Type Yes / No ) '
                                 
    					if ($confirmation -eq 'YES' -Or $confirmation -eq 'Y') {
      					# proceed
    					Write-Host "Starting VDA Configuration....Please Wait...." -ForegroundColor "Cyan"
    					
    					$userlogvar | out-file $usercaplog
                        Start-Process $vdaexe -Argumentlist $argies -workingdirectory $dpath -wait
    					#cmd /c $vdaexe + $args -wait
    					#write-host $vdaexe $args
    					#Write-Host $vdaexe + $installcmd
    					
    					#$installcmd | out-file -filepath $cmdbatfile -Encoding 
    					}
    					else
    					{
    					Write-Host "Aborting...." -ForegroundColor "Red"
    					Exit
    					}
                    
    				Write-Host "VDA Install Completed!" -ForegroundColor "Green"
    				Write-Host
    				Write-Host "Server will reboot in 10 seconds!" -Backgroundcolor "Yellow" -ForegroundColor "Red"
    				
                    Start-Sleep -s 10
    				Restart-Computer -ComputerName "localhost"
    		exit
               } 'q' {
                    return
               }
         }
         pause
    }
    until ($input -eq 'q')

    • Changed type Bill_Stewart Monday, March 19, 2018 5:45 PM
    • Moved by Bill_Stewart Monday, March 19, 2018 5:45 PM This is not "fix/debug/rewrite my script for me" forum
    Friday, February 16, 2018 9:07 PM

All replies

  • Sorry, but we can't troubleshoot long scripts on demand.

    The usual advice is this: Start slowly and write a short script that contains only the absolute minimum amount of code needed to reproduce the problem. When you run into the problem, you need to describe it (provide exact error messages; "it's slow" or "it doesn't work" is not sufficient) because readers in this forum do not have access to your computer and we cannot see your screen.


    -- Bill Stewart [Bill_Stewart]

    Friday, February 16, 2018 9:10 PM