Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Processes watcher does not work

$
0
0

Hi,

I found this script out on the interwebs and it looks like it will do what I want, however,

It has trouble with -ne $Null. Here is the script:

 Function Start-MsiExec($Command)
> {
>   While (Get-Process msiexec -ne $Null)
>   {
>     Write-Verbose "Waiting for running process to complete"
>     Start-Sleep 5
>   }
>   ([WMICLASS]"\root\cimv2:win32_process").create($Command)
> }
> 
> Start-MsiExec "cmd.exe /K `"c:\Hot_Fix_W2K8\Windows6.1-KB974431-x64.msu 
> /quiet /norestart`""

The error message is:

         "-ne is not recognized as a parameter." at line 2  Get-Process msiexec -ne $Null


Viewing all articles
Browse latest Browse all 2562


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>