Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

If test condition result to csv file

$
0
0

Hi Team,

Below are the few lines of my script, Could any one tell me how to export the If-condition test result  of this script to a csv file

$Servers= import-csv "C:\testcounter.csv"
$MasterArray = @()
ForEach($Server in $Servers)
{
$ObjectName=$Server.ObjectName
$CounterName=$Server.CounterName
$InstanceName=$Server.InstanceName
$Server=$Server.Server
If(Test-Connection -quiet -computer $server)
{
$Result=Get-Counter -Counter "\\$server\$ObjectName($InstanceName)\$CounterName"
}

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles