Jump to content


We use cookies to let you log in, for ads and for analytics. OK

Photo

powershell - wait for process to finish




  • Please log in to reply
2 replies to this topic

#1 Polarman

Polarman

    Member

  • Established Members
  • PipPip
  • 17 posts

Posted 05 December 2016 - 11:40 AM

I have a script installing "LabView" from "National Instruments".

However the installer (setup.exe with parameters) is just starting a lot of other installers, and when I use SCCM and detection method the software goes to "installed" just after starting install, although it continues for another hour (!).

That is because im checking if a file is present.

 

How could I instead check for "when a process finish or exits then the software is installed"?

 

Knut





#2 anyweb

anyweb

    Administrator

  • Root Admin
  • PipPipPip
  • 7,210 posts
  • Gender:Male
  • Location:Sweden
  • Interests:Deploying Operating systems and more with System Center Configuration Manager

Posted 06 December 2016 - 01:20 PM

try | Out-Null like so

write-host "about to install SQL Server 2016 SSMS..." -nonewline
$Parms = " /Install /Quiet /Norestart /Logs log.txt"
$Prms = $Parms.Split(" ")
& "$filepath" $Prms | Out-Null
Write-Host "done!" -ForegroundColor Green

it won't release the process until it's complete


Microsoft MVP > Enterprise Client Management
My linkedin profile at > linkedin.com
Follow me on Twitter > ncbrady
Follow windowsnoob.com on Twitter > windowsnoob
My blog

#3 Polarman

Polarman

    Member

  • Established Members
  • PipPip
  • 17 posts

Posted 09 December 2016 - 07:04 AM

try | Out-Null like so


& "$filepath" $Prms | Out-Null


it won't release the process until it's complete

Can I change this to "start-process "$filepath" -argumentlist "$arguments" | Out-Null ?

Or is the "&" only set for this?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users