Get the list from GET-Content
$list = (Get-Content "C:\scripts\lists.txt")
Lists.txt just has server names
Server1
Server2
Server3
For shutting down, works fine. For Deleting, again works fine.
As for the Get-VM script... interesting result (edit for security)
Here is the full script I wrote to get the value
Connect-VIServer "myvcenter"
$VM = (Get-VM -Name "myvm" | Select Name,Powerstate)
Write-Output $VM
Disconnect-VIServer -Confirm:$false
RESULT:
Name | Port User | |
---- | ---- ---- | |
myvcenter | ### Domain\Boston Tech Guy |
Name | : myvm |
PowerState : PoweredOn
So that script gave the correct result....