What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

code: PE132

Votes:

0

Hello,

I'm getting this error:

Response not wellformed: "(File C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\SqlChecker. ps1 cannot be loaded because the execution of scripts is disabled on this syste m. Please see "get-help about_signing" for more details. At line:1 char:2 + & <<<< 'C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\SqlChe cker.ps1' 'Server=FQDN of server;Database=Master;User Id=XXXXXX;Password =XXXXXX;' 'SELECT Top 1 * FROM spt_monitor'; exit $LASTEXITCODE + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException )" (code: PE132)

I've got the follwoing Powershell script:

param([string]$connectionString, [string]$query)

try
{
	$connection = New-Object System.Data.SqlClient.SqlConnection
	$connection.ConnectionString = $connectionString
	$connection.Open()

	$command = $connection.CreateCommand()
	$command.CommandText = $query

	$result = $command.ExecuteNonQuery()

	Write-Host "1:OK"
	Exit 0
}
catch [System.Data.SqlClient.SqlException]
{
	Write-Host "0:SQL exception"
	Exit 2
}
catch
{
	Write-Host "0:Error"
	Exit 2
}

The server running the Remote Probe and the target server have ExecutionPolicy set to Unrestricted (for testing) --> Set-ExecutionPolicy Unrestricted.

However, I'm still getting the same error. Could you guys point me in the right direction?

powershell remote-powershell sql

Created on Jan 29, 2015 8:34:57 AM

Last change on Jan 29, 2015 8:43:53 AM by  Torsten Lindner [Paessler Support]



2 Replies

Votes:

10

The PRTG Probe will call the 32bit Powershell, this is important for setting the ExecutionPolicy. Please check if you got the right Powershell.

Regards
Birk Guttmann

Created on Jan 29, 2015 10:12:42 AM



Votes:

0

Hello Birk

that worked, thanks a bunch! :)

Created on Jan 29, 2015 11:36:25 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.