I've been trying to run a PowerShell script from a batch file to remove OneDrive, but I'm running into an error. I have two files in C:Temp: RemoveOneDrive.ps1 and RemoveOneDrive.bat. The PowerShell script works perfectly on its own, but when I try to execute it from the batch file using the command `Powershell.exe Set-ExecutionPolicy RemoteSigned -File "C:TempRemoveOneDrive.ps1"`, I get an error stating that a parameter cannot be found that matches the parameter name 'File'. Can anyone help me figure out what I'm doing wrong? Thanks in advance!
1 Answer
It looks like the issue with your batch file is in how you're structuring the command. Instead of `Powershell.exe Set-ExecutionPolicy RemoteSigned -File "C:TempRemoveOneDrive.ps1"`, try using `Powershell.exe -ExecutionPolicy RemoteSigned -File "C:TempRemoveOneDrive.ps1"`.

Thanks for the quick reply! I made that change, but now I'm seeing a different error. It says that the file isn't digitally signed and cannot be run. What do I do about that?