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

Script error

Votes:

0

I am creating a script to monitor if a pc has more than one network connection, ie wired and wireless. The script below does not seem to work with the count option for the array. It just returns 0.

param(
    [string]$ComputerName = "",
    [array]$myNetCon = @()
)

$myNetCon += Get-Netadapter -cimsession $ComputerName -physical | where status -eq 'up'

if($myNetCon.Count -gt 1)
    {
    Write-Host("0:BAD")
    }
    else
    {
    Write-Host ("1:OK")
    }

custom-sensor powershell prtg

Created on Oct 30, 2019 11:56:39 PM

Last change on Oct 31, 2019 6:11:08 AM by  Torsten Lindner [Paessler Support]



4 Replies

Votes:

0

Your script seems sound.

Are you running it with the "Security Context" set to "Use Windows credentials of parent device" and an account with permission on the target device(s)?

Created on Dec 13, 2019 11:16:15 AM



Votes:

0

Yes, i have those set. I have since learnt that i needed the Invoke command as my script only ran on the core server. I have done this but still no joy.

Created on Dec 17, 2019 9:49:13 PM



Votes:

0

Looking at the logs is say it failed to connect to the destination specified in the request. OpenError PSRemotingTransportException.

I have checked winrm and all looks fine and i can use the remote powershell from the core server to run remote commands on the PC.

Created on Dec 18, 2019 3:23:19 AM



Votes:

1

Hi there,

Please make sure that the execution policy for the x32 Powershell is configured correctly. You can find more information about this and other troubleshooting steps in this article.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Dec 18, 2019 12:31:33 PM by  Birk Guttmann [Paessler Support]




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.