20211222
I am working on the following script, but having problems with the foreach loop.
What are those problems?
Update: the Format-Table at the end of the pipeline where you populate the $VMS variable is wrong.
Remove that.
With that you will not have VirtualMachine objects in $VMS, but console formatted output
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Shutting down Microsoft.PowerShell.Commands.Internal.Format.FormatStartData.Name
Stop-VM:
Line |
12 | Stop-VM -VM $_.Name -Confirm:$true
| ~~~~~~~
| Cannot validate argument on parameter 'VM'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
You are great. That was the issue!
Thank you!