Hello,
Can someone tell me how to export to a file?
I need the VM name, IPAddress and NetworkName(vlan id).
The below gives me the information that I need in PowerCLI, but I need to have it in a csv or txt.
The output is larger than the screen, so I can't just copy all of it.
Needless to say, I don't use PowersCLI that often and couldn't find my answer.
Thank you!
Get-VM |
ForEach-Object {
$VM = $_
$VM | Get-VMGuest | Select-Object -ExpandProperty Nics |
ForEach-Object {
$Nic = $_
foreach ($IP in $Nic.IPAddress)
{
if ($IP.Contains('.'))
{
"" | Select-Object -Property @{Name='VM';Expression={$VM.Name}},
@{Name='IPAddress';Expression={$IP}},
@{Name='NetworkName';Expression={$Nic.NetworkName}}
}
}
}
}