- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, got it.
I suspect there might be an issue with the Get-VM line.
That ErrorAction will result in your code never reaching the catch-block.
Try changing that line to
$script:target = Get-VM $line -ErrorAction Stop
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference