$computername = Get-Content "C:\pscripts\Input\hostlistdev.txt" foreach ($srv in $computername) { get-vm $srv | Select-Object Name, Host }