Igor5's Posts

Thanks @LucD  Added: @{N='Tags';E={(Get-TagAssignment -Entity $VM).Tag -join '|'}}, I thought it was in the properties
Hello everyone! There is a script that collects some statistics. I want to add VM tags to it, but I can't find them in the properties. There is no - $VM.ExtensionData. Here, too, is $VM.Guest. How t... See more...
Hello everyone! There is a script that collects some statistics. I want to add VM tags to it, but I can't find them in the properties. There is no - $VM.ExtensionData. Here, too, is $VM.Guest. How to add? Help! Get-Cluster | Get-VM -PipelineVariable vm | Get-NetworkAdapter | Select @{N='VM';E={$vm.Name}},NetworkName, MacAddress, @{N=”IP Address”;E={ $nic = $_ $ips = ($vm.Guest.Nics | where{$_.Device.Name -eq $nic.Name}).IPAddress ($ips | where{([ipaddress]$_).AddressFamily -eq 'InterNetwork'}) -join '|'}}, @{N='Gateway';E={($VM.ExtensionData.Guest.IpStack.IpRouteConfig.IpRoute.Gateway.IPaddress | where{$_ -ne $null}) }}, @{N="DNS";E={$vm.ExtensionData.Guest.IpStack.DnsConfig.IpAddress}}, @{N="Subnet Mask";E={$vm.ExtensionData.Guest.Net.IpConfig.IpAddress.PrefixLength}}, @{N='OS';E={$vm.Guest.OSFullName}}, @{N='CreateDate';E={$vm.CreateDate}}, @{N="Tags";E={??????????????}, - help here @{N="Attributes";E={[string]::Join('|',($VM.ExtensionData.Value.Value))}} | Out-GridView
Thanks for the help. I tried to make a match by values, but nothing came out. That's why I wrote here. I thought they would help me here.
The script works and brings information. But if I have 4 network interfaces, then the gateway, DNS and mask are going into one. And I want each interface to correspond to its gateway, DNS and mask.
Hi! Help me figure out the problem! I can't find the correct values for DNS, Gateway, Mask. So that each address corresponds to the correct value DNS, Gateway, Mask. Script: Get-Cluster | Get-VM ... See more...
Hi! Help me figure out the problem! I can't find the correct values for DNS, Gateway, Mask. So that each address corresponds to the correct value DNS, Gateway, Mask. Script: Get-Cluster | Get-VM -PipelineVariable vm | Get-NetworkAdapter | Select @{N='VM';E={$vm.Name}},NetworkName, MacAddress, @{N=”IP Address”;E={ $nic = $_ $ips = ($vm.Guest.Nics | where{$_.Device.Name -eq $nic.Name}).IPAddress ($ips | where{([ipaddress]$_).AddressFamily -eq 'InterNetwork'}) -join '|'}}, @{N='Gateway';E={($VM.ExtensionData.Guest.IpStack.IpRouteConfig.IpRoute.Gateway.IPaddress | where{$_ -ne $null}) }}, @{N="DNS";E={$vm.ExtensionData.Guest.IpStack.DnsConfig.IpAddress}}, @{N="Subnet Mask";E={$vm.ExtensionData.Guest.Net.IpConfig.IpAddress.PrefixLength}}, @{N='OS';E={$vm.Guest.OSFullName}}, @{N="Attributes";E={[string]::Join('|',($VM.ExtensionData.Value.Value))}} | Out-GridView