For another script im making i need a list of my VM's. I use the following script for that:
Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer vmXX Connect-VIServer vmXI $vms = get-vm | where { ($_.powerstate -eq "poweredon") } $rows = @() Foreach ($VM in $vms) { $View = $VM | get-view $Config = $View.config if ($Config.Template) { continue } $row = New-Object -TypeName PSObject $row | Add-Member -MemberType NoteProperty -Name $Config.Name $rows += $row } Now this outputs the names as VM : VMXX - Build Server I've tried -replace and -trim but i cant find a way to just get a clean list with only VM names in it and nothing else.