Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Powershell not found but present

Hi,

some workstations returning the error code 1 if we try to deploy a package with a powershell step inside. That means powershell was not found.

But all workstations (windows 10) have powershell 5 and i'm able to run powershell if i type powershell into run or cmd on the workstation

I tried to update the path in the system environment with:

setx PSModulePath %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\ /M

but nothing changed.

Workaround is to change the command line inside the package from

PowerShell.exe -NoLogo -NonInteractive -ExecutionPolicy Bypass

to

C:\windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoLogo -NonInteractive -ExecutionPolicy Bypass

But that solution dosen't make me happy at all

Any ideas?

0

Comments

6 comments
Date Votes
  • What do you get if you run "ECHO %PATH%" as a command step? Maybe your service account doesn't have PowerShell in its path.

    0
  • C:\ProgramData\Oracle\Java\javapath;C:\orant\bin;C:\orant\jdk\bin;C:\orant\jre\1.4.2\bin\client;C:\orant\jre\1.4.2\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0";C:\Program Files (x86)\Common Files\Adobe\AGL;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Panda Security\WaAgent\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Administrator.AHAG-GROUP\AppData\Local\Microsoft\WindowsApps

     

     

    0
  • What is the full error you are getting? Error code 1 can mean many things.

    0
  • As i mentioned in in the starting post: Powershell.exe is misspelled or could not be found.

    Der Befehl "PowerShell.exe" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden.

    Misspelled is not possible, it really looks like that the path to powershell ist really not avaible for the service account. But the path ist set global, not per user.

    Maybe it's the double entry in path, the first one ends with " but dosent start with a ".
    I check this monday

     

     

     

     

    0
  • Ah, good catch. I too believe it's the double quote in your PATH. When I threw a double quote into the PATH of a test machine it threw the same error.

    0
  • Yes, removing the double quote solves the problem on this PC
    I check the other PCs for similiar errors.

     

    Thanks

    0