Search code examples
powershellvnc

Problem with Start-Process when trying to start UltraVNC-Session (but works in CMD)


My goal is to start UltraVNC via Powershell (as part of function in a script)
Breaking it down to the specific issue:

in Cmd
"C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe" -connect myserver -dsmplugin myplugin.dsm
is working fine, it starts UltraVNC and connects to my server with the plugin we use.

for a Powershell-equivalent i tried
Start-Process -FilePath "C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe" -ArgumentList "-connect myserver -dsmplugin myplugin.dsm"
Powershell starts UltraVNC but there is no server entered in the UltraVNC-Window and the connection fails.
(VNC Server: [Blank], Port: 5900, Status: ...)

My thoughts:
I assumed the -ArgumentList might not hand over the parameters correctly because the server is missing.
However, if i omit the parameter for the -dsmplugin, it is recognized that theres no plugin used for starting a secure connection. To me it shows that the ArgumentList is handed over correctly.
So i probably make a mistake in the -connect parameter which might has something to do with quotation marks etc.
That made me lookup the Powershell quoting rules and use ' or " for the parameters etc .. However, the outcome is the same: VNC starts but does not have the parameter for the server to connect to.

Eventually i got out of ideas of how to identify what my mistake is as i'm rather new to powershell.

Thanks in advance for any help!

#UltraVNC Cmd documentation:
#https://www.uvnc.com/docs/uvnc-server/51-ultravnc-server-commandline-parameters.html


Solution

  • Eventually i ended up not using the Start-Process but simply added an Ampersand & ahead of the working cmd-command and it is working fine.

    &"C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe" -connect myserver -dsmplugin plugin.dsm

    This solves it for me, although i do not know why it won't do the same when using Start-Process and -ArgumentList for it.