PowerShell execution of scripts is disabled via RCC [Fixed]

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
Andy001
Posts: 4
Joined: Fri Jan 02, 2015 7:40 am

PowerShell execution of scripts is disabled via RCC [Fixed]

Post by Andy001 »

Hi

When I attempt to run a powershell script through a shell script when hostmonitor is running as a service I receive the error:
File <temp .ps1 file> cannot be loaded because the execution of scripts is disabled on this system.

I've set the execution policy correctly for both 32 and 64 bit powershell and I can run powershell scripts directly on the server hosting hostmonitor.

If I run hostmonitor as an application and not as a service the powershell scripts run fine.

If I take a copy of the powershell exe and try running it from a different location on the server I receive an error 'device is not ready'.

The hostmonitor service is running under a local administrator account.

Here are my UAC settings (all other settings are disabled):

Admin Approval Behaviour: Elevate without prompting
Standard User Approval Behaviour: Prompt for credentials
Elevate UIAccess apps that are installed in secure locations: Enabled
Switch to the secure desktop when prompting for elevation: Enabled
Virtualise file and registry write failures to per user locations: Enabled

The error I'm seeing suggests it is UAC issue and if this is the case, which of the above UAC settings need to change?

I'm running Hostmonitor 9.90 on Windows 2008 R2.

Thanks for your help and happy new year :)
Last edited by Andy001 on Mon Jan 05, 2015 7:49 am, edited 1 time in total.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

This does not look like UAC related problem.
What exactly Execution policy have you set?

Could you try to run 32-bit and 64-bit Powershell consoles using "Run as Administrator" and execute command like the following:
Set-executionpolicy RemoteSigned
Andy001
Posts: 4
Joined: Fri Jan 02, 2015 7:40 am

Post by Andy001 »

I've tried your suggestion and I get the same result.

Upon further analysis the test is actually working. I get the error when I use the "Let's try" tab in Script Manager and use the Test button. When I save the test and let Hostmonitor run it normally the test works fine.

Bizarre.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

When I save the test and let Hostmonitor run it normally the test works fine.
That means there is no problem with script or RMA agent.
May be you forgot to select correct RMA agent in "Lets Try"?
Or to short timeout is specified in "Lets Try" tab.
Andy001
Posts: 4
Joined: Fri Jan 02, 2015 7:40 am

Post by Andy001 »

I double checked, the test agent and the 'test by' agent are both the same. The timeout isn't related as the error is specific to the powershell execution policy as per the error, however I increased it anyway and retried - same result.

Not a big deal as the actual test works. It would be nice if I could test the script directly in script manager though.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Are you using RCC to manage HostMonitor and Test by (in "Lets try" tab) is set to HostMonitor?
In such case, script is executed on RCC system.
Andy001
Posts: 4
Joined: Fri Jan 02, 2015 7:40 am

Post by Andy001 »

Bingo! Yes, I am managing Hostmonitor via RCC and indeed the computer which is running RCC did not have the PowerShell execution policy set for x64. I set the executionpolicy to remotesigned and the test was successful. I'm not sure what the test by agent is for then if it runs whereever RCC is running, nonetheless the mystery is solved :).
Post Reply