As subject.
Thanks!
Hugo
The @#!&* forum SW dropped the new-lines (again).
Try the attached script.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Something like this ?
Get-VM | where {$_.PowerState –eq "Poweredon"} | %{write-host $_.name $_.host.name}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
How can I pipe it to csv file?
Something like.
$report = @() Get-VM | where {$_.PowerState –eq "Poweredon"} | %{ $row = "" | select VMname, HostName $row.VMName = $_.Name $row.HostName = $_.host.Name $report += $row } $report | Export-Csv "C:\report.csv" -noTypeInformation
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
error with @() Get-vm
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> $report = @() Get
-VM | where {$_.PowerState -eq "Poweredon"} | %{ $row = "" | select VMname, Host
Name $row.VMName = $_.Name $row.HostName = $_.host.Name $report += $row } $repor
t | Export-Csv "C:\report.csv" -noTypeInformation
Unexpected token 'Get-VM' in expression or statement.
At line:1 char:21
+ $report = @() Get-VM <<<< | where {$_.PowerState -eq "Poweredon"} | %{ $row
= "" | select VMname, HostName $row.VMName = $_.Name $row.HostName = $_.host.Na
me $report += $row } $report | Export-Csv "C:\report.csv" -noTypeInformation
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows>
The @#!&* forum SW dropped the new-lines (again).
Try the attached script.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I was a bit surprized to see myself asking this question.
Turns out I have a "doppelganger". Hello Hugo!
Check out my website for more example scripts: www.peetersonline.nl
Hugo Peeters
I was a bit surprized to see myself asking this question.
Turns out I have a "doppelganger". Hello Hugo!
Check out my website for more example scripts: www.peetersonline.nl
Hugo Peeters
"Any resemblance to actual persons, living or dead, is purely coincidental"
Yup, just started playing around with the VI Toolkit.