Is there a way to pass an echo argument with start-process in powershell?

I'm trying to automatically connect an Anydesk Session in Powershell.

According to their CLI documentation, you can pass password with echo.

Right now, I'm starting the process like this, since I need the process ID afterward.

$app = Start-Process $config.anydesk_path -ArgumentList @($config.ip_addresses[$i], "--plain") -passthr

I've tried appending the password to the Argument List like this

$app = Start-Process $config.anydesk_path -ArgumentList @($config.connect_pw, $config.ip_addresses[$i], "--plain", "--with-password") -passthru 

but that doesn't seem to enter the password.

Is there a way to send the password with Start-Process?



Sadly, Start-Process can only accept input from a file (See -RedirectStandardInput parameter).

You can use .NET Framework Process class directly:

$AnyDesk = New-Object System.Diagnostics.Process

$AnyDesk.StartInfo.FileName = $config.anydesk_path
$AnyDesk.StartInfo.UseShellExecute = $false

# This allows writing to a standard input stream:
$AnyDesk.StartInfo.RedirectStandardInput = $true

$AnyDesk.StartInfo.Arguments = "$($config.ip_addresses[$i]) --plain --with-password"


# Write a password into standard input stream:

# Grab a process ID:

Previous : How to force HTTPS on all URL's except one directory /images using .htaccess?
Next : firebase deployment issue getting a page from firebase telling me firebase hosting setup is complete when i should get my websit