The system cannot find the file specified

I’m relatively new to the PSDT but really enjoying what I’m learning… I currently deploy via SCCM and would like to leverage this toolkit in a handful of instances.

So far I’ve been able to set this up for a product that requires the old version to be uninstalled along with a separate updater that doesn’t uninstall unless specifically called and so far so good but my issue is when I go to run the setup.exe /s (response file is done and this works if ran via CMD line)…

When I attempt to run that line from PS it comes back with:

<code>Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:3
+         Start-Process &quot;Setup.exe&quot;
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand</code>

This is what I’m using to launch the install:
Start-Process “Setup.exe” -ArgumentList “/s” -Wait

I know that it can’t find it because powershell is running from another location on my computer but the script is saved within the folder that the setup.exe and iss file is located.

I feel like I’m either doing something seriously wrong or something very simple and just over looking…

Any help is GREATLY appreciated because I know I’ll have this issue with future installs. I was able to use the office example without much trouble and have been taking bits and pieces here and testing but having no luck.

Thanks in advance for any help!

Wouldn’t it be:

Execute-Process -Path "Setup.exe" -Parameters "/s"

If you are calling the setup you need to tell it where to find the file. Follow an example which is listed in the guide:
Execute-Process -Path “$dirFiles\Bin\setup.exe” -Parameters ‘/S’ -WindowStyle ‘Hidden’

You can also use a network path if you are calling the script from another location on the network.

Right, I understand that it’s not finding the setup.exe because it’s defaulting to the location where Powershell is running…

That being said, isn’t there a way for it to fire off the ‘setup.exe’ from within the same folder the script is at?

I can’t necessarily state a specific folder because we deploy these through SCCM and therefore it could cache to c:\windows\ccmcache\23 or c:\windows\ccmcache\1a

Does that make sense? That is the main reason I was hoping there was something I was just missing though…

Your Setup.exe should be placed in the \Files folder along with all the other files that Setup.exe requires. Execute-Process will look there first.

If you want to be explicit, that depends on where you place Setup.exe.
If it’s the same folder as Deploy-Application.ps1 then it’s $scriptDirectory