With the below Powershell Script, I can display both the Network Total Bytes Per Second and Total Bytes Received. When I try to divide on the 3rd line, I receive the following error: (Listed Below my Code)
$cnt = ([int]"\Network Interface(B*)\Bytes Total/sec")
$cat = "\Network Interface(B*)\Bytes Received/sec"
$cant = ($cat,$cnt)
get-counter -ComputerName Server1, Server2 -counter $cant
Cannot convert value "\Network Interface(B*)\Bytes Received/sec" to type "System.Int32". Error: "Input string was not
in a correct format."
At line:1 char:1
+ $cant = ($cat/$cnt)
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: ) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastFromStringToInteger
I am just trying to get the Network Utilization of my two servers, then display it in an HTML report
$cnt = ([int]"\Network Interface(B*)\Bytes Total/sec")
$cat = "\Network Interface(B*)\Bytes Received/sec"
$cant = ($cat,$cnt)
get-counter -ComputerName Server1, Server2 -counter $cant
Cannot convert value "\Network Interface(B*)\Bytes Received/sec" to type "System.Int32". Error: "Input string was not
in a correct format."
At line:1 char:1
+ $cant = ($cat/$cnt)
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: ) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastFromStringToInteger
I am just trying to get the Network Utilization of my two servers, then display it in an HTML report