Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Start-Process DirectoryNotFoundException

$
0
0

Good day.
I want to remotely run a Windows update from 1809 to 1903.
If I enter commands one by one, the computer will reboot and install the update.
Here are the commands that I enter

Enter-PSSession ComputerName-001 -Verbose

Start-Process -FilePath 'C:\$WINDOWS.~BT\Sources\SetupHost.exe' -WorkingDirectory 'C:\$WINDOWS.~BT\Sources' -ArgumentList '/finalize /update'

Get-PSSession | Remove-PSSession

But when I run these commands as a script, I get an error

The command cannot be executed because the "WorkingDirectory" parameter has an invalid value or cannot be used with this command. Enter valid data and try again.

InvalidOperation: (:) [Start-Process], DirectoryNotFoundException

DirectoryNotFoundException,Microsoft.PowerShell.Commands.StartProcessCommand

I can not overcome this problem 

I tried Invoke-Command but the process does not start.

Tell me how to make it work in the script.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>