Foreach ($servername in Get-Content servername.txt ){
Write-Host -------------- $servername -----------------------
write-host --------------------------------------------------
$Session = New-PSSession -ComputerName $servername
Enter-PSSession -Session $Session -Verbose
Invoke-Command -Session $Session -ScriptBlock{
Foreach ($vmname in (Get-VM).Name){
Write-Host $vmname (Get-VM -Name $vmname).State (Get-VMHardDiskDrive -VMName $vmname).Path}
exit
}
Remove-PSSession -id (Get-PSSession).Id
write-host --------------------------------------------------
}