Sounds like you’re missing an environment variable.
Add this to your Path
environment variable:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
OR
Change your script to this:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "your command"
More Related Contents:
- How to do password-less login using plink? [closed]
- Batch file v PowerShell script
- Powershell: null file always generated (output of Compare-Object)
- Using UTF-8 Encoding (CHCP 65001) in Command Prompt / Windows Powershell (Windows 10)
- How to run a PowerShell script without displaying a window?
- Dependency Walker: missing dlls
- How to run a PowerShell script
- How to run a PowerShell script from a batch file
- $LastExitCode=0, but $?=False in PowerShell. Redirecting stderr to stdout gives NativeCommandError
- How to run a PowerShell script within a Windows batch file
- How do I get the current username in Windows PowerShell?
- Unix tail equivalent command in Windows Powershell
- PowerShell: Setting an environment variable for a single command only
- Capture program stdout and stderr to separate variables
- Convert a small PS script into a long line in a .BATch file
- Running cURL on 64 bit Windows
- How does PowerShell treat “.” in paths?
- How do you successfully change execution policy and enable execution of PowerShell scripts
- PowerShell stripping double quotes from command line arguments
- Get Folder Size from Windows Command Line
- How to create a Run As Administrator shortcut using Powershell
- Start a detached background process in PowerShell
- How to output something in PowerShell
- Windows Script Host Error: Invalid character – Code:800A03F6 – Source: Microsoft JScript compilation error
- PsExec Throws Error Messages, but works without any problems
- What’s the environment variable for the path to the desktop?
- MSOnline can’t be imported on PowerShell (Connect-MsolService error)
- powershell : changing the culture of current session
- IE Enable/Disable Proxy Settings via Registry
- Powershell: What’s the difference between Alias and Function?