Spaces in Start-Process -filepath issue

I am using start-process to start a RVtools (as that is what my company are using to report on…i know i can use Power-Cli, and I would but for now would like like to embrace existing processes using RVtools and then seek to improve it…).


I am using a method that was shown to me before by passing an argument list.

I have the relevant sections below:


$vcentre = ‘vcentreserver’
$arglist = '-s {0} ’ -f $vcentre
$path = ‘C:\Program Files (x86)\Robware\RVTools’
$tskParams = @{
FilePath ="$path\RVTools.exe"
ArgumentList = $argList
Wait = $true
NoNewWindow = $true

Start-Process $tskParams


Yet when I run this I get the error :

Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:9
+ Start-Process $tskParams -ErrorVariable test
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:slight_smile: [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand


However when I use


Start-Process -FilePath “C:\Program Files (x86)\Robware\RVTools\RVTools.exe”

it works. I am not quite sure what is going on…any help appreciated

Troubleshooted my own error

When I splatted I used $taskparams instead of @tskparams. Go figure … :smiley:

I do it all the time too. I’ve tried to use editor shortcuts like this:

Unfortunately, I’m usually RDP’d to a customer server, so I don’t install tools on those devices. If you are fortunate to be using a single editor, they have options for VSCode and Powershell ISE to create a hotkey for auto-formmatting a splat.