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]



Replies

Nobody has replied yet

Why not be the first?

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.