New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Script error

Votes:

0

Your Vote:

Up

Down

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 by  JohnC (0) 1

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



4 Replies

Votes:

0

Your Vote:

Up

Down

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 by  Ross McLachlan (0) 1



Votes:

0

Your Vote:

Up

Down

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 by  JohnC (0) 1



Votes:

0

Your Vote:

Up

Down

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 by  JohnC (0) 1



Votes:

1

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.