This is just a test post. I am trying to test the use of the code button to see if it works like the wiki’s do.
$input | ForEach-Object {
$managedHost = $global:vmwareManagedHosts[$_.Host]
$vmh = Get-VMHost $_.VMhost -server $managedHost.Connection | Get-View
foreach ($Nic in $_.Nic){
$vmh.Config.Network.Pnic | where {$_.device -eq $Nic} | ForEach-Object {
$pNicDevId = $_.Pci
$PCIDevice = $vmh.Hardware.PciDevice | Where-Object {$_.id -eq $pNicDevId}
$Duplex = "Half"
if ($_.LinkSpeed.Duplex -eq $True){$Duplex = "Full"}
$LinkStatus = "Up"
if ($_.LinkSpeed -eq $null){
$LinkStatus = "Down"
$Duplex = $null
}
$LinkConfig = "Auto Negotiate"
if ($_.Spec.LinkSpeed -ne $null){
$SpecDuplex = "Half"
if ($_.Spec.LinkSpeed.Duplex -eq $True){$SpecDuplex = "Full"}
$LinkConfig = "$($_.Spec.LinkSpeed.SpeedMb, $SpecDuplex)"
}
$pNic = New-Object PSObject
$pNic.PSObject.TypeNames.Clear()
$pNic.PSObject.TypeNames.Add("VMware.AdvVirtualDisk")
$pNic `
| Add-Member -MemberType NoteProperty -Name Device -Value $_.Device -PassThru `
| Add-Member -MemberType NoteProperty -Name VMHost -Value $vmh.Name -PassThru `
| Add-Member -MemberType NoteProperty -Name LinkStatus -Value $LinkStatus -PassThru `
| Add-Member -MemberType NoteProperty -Name LinkConfig -Value $LinkConfig -PassThru `
| Add-Member -MemberType NoteProperty -Name LinkSpeed -Value $_.LinkSpeed.SpeedMb -PassThru `
| Add-Member -MemberType NoteProperty -Name Duplex -Value $Duplex -PassThru `
| Add-Member -MemberType NoteProperty -Name MACAddress -Value $_.Mac -PassThru `
| Add-Member -MemberType NoteProperty -Name NICVendor -Value $PCIDevice.VendorName -PassThru `
| Add-Member -MemberType NoteProperty -Name NICModel -Value $PCIDevice.DeviceName -PassThru `
| Add-Member -MemberType NoteProperty -Name NICDriver -Value $_.Driver -PassThru `
| Add-Member -MemberType NoteProperty -Name PCI -Value $_.Pci -PassThru `
| Add-Member -MemberType NoteProperty -Name PCIBus -Value $PCIDevice.Bus -PassThru `
| Add-Member -MemberType NoteProperty -Name PCISlot -Value $PCIDevice.Slot -PassThru `
| Add-Member -MemberType NoteProperty -Name WakeOnLan -Value $_.WakeOnLanSupported -PassThru `
| Add-Member -MemberType NoteProperty -Name Key -Value $_.Key -PassThru `
| Add-Member -MemberType NoteProperty -Name Host -Value $managedHost.Name -PassThru
}
}
}
That is about it.
0 Responses to “Using the Code button”
Leave a Reply