Start-Process issue

Welcome Forums General PowerShell Q&A Start-Process issue

This topic contains 3 replies, has 3 voices, and was last updated by

4 years, 3 months ago.

  • Author
  • #24008

    Topics: 3
    Replies: 5
    Points: 0
    Rank: Member

    One of our clients uses a program called Meditech. It has an .exe that can be installed as a Service, which is needed in multi user environments (terminal server/windows 7 with multiple people logged in at once..etc).

    The exe is located in C:\Program Files (x86)\MEDITECH\Print\VMAGICPPII.EXE on all client machines. If I navigate to this path using the command prompt and then run VMAGICPPII.EXE -i a second dos window pops up and installs the service.

    I am trying to automate this in Powershell, but I am not getting any results and am unsure on how to either go about this differently or figure out why this is not working.

    Below is my test code, I even tried to go directly to the directory and launched the .exe directly.

    $path64 = "VMAGICPPII.EXE"
    $64 = "C:\Program Files (x86)\MEDITECH\Print\VMAGICPPII.EXE"
    $path32 = '"C:\Program Files\MEDITECH\Print\VMAGICPPII.EXE"'
    $Installed = $false
    $parameter = "-i"

    if(Test-Path -Path $64)
    Write-Debug "64bit System"
    #Start-Process -FilePath $path64 -ArgumentList "-i" -wait
    cd "c:\"
    cd "program files (x86)"
    cd "meditech"
    cd "print"

    & "$path64 $parameter"
    # iex "$path64 $parameter"

  • #24010

    Topics: 0
    Replies: 74
    Points: 0
    Rank: Member

    Try launching it with cmd.exe


    & cmd.exe /c $Path32 -i
  • #24013

    Topics: 2
    Replies: 525
    Points: 24
    Team Member
    Rank: Member

    Hi Daniel,

    I think you might be using the wrong variable in your Start-Process or & call. You are testing for the existence of the executable with $64 but you use $path64 which does not contain the full path to start the process? I would get rid of "$path64 = "VMAGICPPII.EXE", rename $64 to $path64 and modify the Test-Path statement to use $path64.

    I hope that makes sense.


  • #24018

    Topics: 3
    Replies: 5
    Points: 0
    Rank: Member

    Daniel, that would be the case in this test script now, but that is because I Had modified the variable after I tried to CD to the path, sorry for the confusion, I knew I was pasting bad code, I didn't realize there was a mistake in it though.

    Jack, & cmd.exe /c $Path32 -i is working, thanks!

The topic ‘Start-Process issue’ is closed to new replies.