Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Powershell script to do troubleshooting for some software

$
0
0

I want to write a script to do troubleshooting one software--splunk forwarder:

1) test-connection

2) change path to c:\program files\splunk\

3) list forward-server

4) restart-service


Text
$ServerName = get-content "c:\computers.txt"


foreach ($Server in $ServerName) {

        if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {

            write-Host "$Server is alive and Pinging " -ForegroundColor Green

                    } else

                    { Write-Warning "$Server seems dead not pinging"

                    }

set-location c:\program files\splunk\bin

splunk list forward-server

}  }


Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>