I am attempted to run a powershell script to restart a service on the affected server when PRTG detects that it is down or not responding in a timely fashion. However, when PRTG attempts to run this script, I get this error:
Error sending "EXE": File "Powershell.exe" not found
Powershell 3.0 IS installed on the PRTG box. Do I also need to install Powershell 3.0 on the affected servers as well? (they should already have PS 2.0 as part of windows server)
Article Comments
Powershell.exe runs fine from inside a DOS command line. Any other ideas?
C:\Users\peter.bollwerk-priv>powershell.exe Windows PowerShell Copyright (C) 2012 Microsoft Corporation. All rights reserved. PS C:\Users\peter.bollwerk-priv> exit
Feb, 2014 - Permalink
The problem may occur by 32/64 bit mix ups Please check if you PowerSchell installation matches your PRTG installation.
Feb, 2014 - Permalink
I don't understand what you mean. The server is running Windows Server 2008 R2 (which only comes in 64-bit) When you install Powershell on a 64-bit OS, it installs BOTH 32-bit and 64-bit versions. When PRTG calls on Powershell, it's up to PRTG which version to use, isn't it? As far as Windows is concerned, if you don't specifically run the 32-bit version (ironically in C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe ), then it will run the 64-bit version, as it is located in C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
I'm not Powershell expert, but the books I've been reading say to use the 64-bit version when you're on a 64-bit OS. I'm not sure why it matters though.
Feb, 2014 - Permalink
BTW, here is proof that both versions exist on this server:
C:\>dir /s powershell.exe Volume in drive C has no label. Volume Serial Number is 80D6-EC1D Directory of C:\Windows\System32\WindowsPowerShell\v1.0 08/21/2012 04:17 AM 474,624 powershell.exe 1 File(s) 474,624 bytes Directory of C:\Windows\SysWOW64\WindowsPowerShell\v1.0 08/21/2012 04:43 AM 454,656 powershell.exe 1 File(s) 454,656 bytes
Feb, 2014 - Permalink
Hi,
thank you for your detailed information.
PRTG calls Powershell.exe without any path, so the path must be in the Path variable of the execution environment.
Could you please post the result of the command
set | grep Path
Feb, 2014 - Permalink
FYI - grep is a linux command. It doesn't work in Windows. Here is the path environment variable:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;%systemroot%\System32\WindowsPowerShell\v1.0\ |
It looks like the 64-bit powershell path is in there, but not the 32-bit powershell path. I will add the 32-bit powershell path and test again.
Feb, 2014 - Permalink
Some customers have had to reboot after performing the above actions before this worked correctly.
Jun, 2015 - Permalink
Hi, i have now the same issue. Installed Powershell ver. 3.0 an rebooted. Error "Powershell.exe" not found is stil there.
What can i do?
Thanks
Oct, 2015 - Permalink
Hi there,
Could you post the result of the following command:
Get-ChildItem Env:Path |
Best regards.
Dec, 2017 - Permalink
Hi,
this is the result:
PATH => %SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\Windows\system32;C:\Windows;C:\Windo...
Jan, 2018 - Permalink
Hi kelloxx,
Are you able to run "powershell.exe" via a command line on the Core Server/Probe?
Best regards.
Jan, 2018 - Permalink
Hi kelloxx,
Great, what sensor exactly is affected? More detailed, what sensor type?
Best regards.
Jan, 2018 - Permalink
If you have installed PS3 recently and didn't restarted your PRTG box the path variable to the powershell folder may not be set correctly.
Please try to run Powershell.exe from the DOS command line. If it's not found restart your PRTG box, and try again.
You can check the Path variable by
set | grep Path
Feb, 2014 - Permalink