I am trying to restart multiple app pools from multiple servers.
Example:- Server file - Server1,Server2; AppPool file - AppPool1,AppPool2; Server 1 should check AppPool1 and AppPool2. Server 2 should check and restart AppPool1 and AppPool2.
$Fetch_Details_AppPools = [string[]](Get-Content D:\Users\VRao\Desktop\AUtomation\AppPoolName.csv)
$Fetch_Details_Server = [string[]](Get-Content D:\Users\VRao\Desktop\AUtomation\ServerName.txt)
foreach ($i in $Fetch_Details_Server) {
    foreach ($j in $i.$Fetch_Details_AppPools) {
        Invoke-Command -ComputerName $i -ScriptBlock {
            Import-Module WebAdministration;
            If ((Get-WebAppPoolState(@using:j)).Value -eq "Stopped") {
                write-host("The App pool $using:j is getting started")
                Restart-WebAppPool -Name "$using:j"
            }
            else {
                Write-Host"$using:j is already in start state"
            }
            write-host("The App pool $using:j is started in $using:i")
        }
    }
}
Any errors or help on this?
