We are trying to find a way to see if an ESXi host is on a N1K or standard switch as we are moving all systems to N1K and need to verify it was completed. We thought of using the Get-CDP but since we are using Cisco UCS blades it always comes back Cisco Nexus. Does anyone have any thoughts on how this can be done?
thanks in advance.
Matt
I don't have a N1K handy right now, but does this list the connected ESXi hosts per N1K ?
foreach($dvs in Get-VDSwitch){
Get-View -Id ($dvs.ExtensionData.Config.Host | %{
$_.Config.Host}) |
Select @{N="dvSw";E={$dvs.Name}},@{N="ESX";E={$_.Name}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
We're also having a problem accomplishing the same task when trying to get information about an n1k on a specific node. Trying the other tricks around the Internet don't seem to work when trying to poll data from a specific node, but rather only at the VC level.
Get-VDSwitch -VMHost myhost.example.com
Get-VDSwitch Unable to cast object of type 'VMware.Vim.DistributedVirtualSwitch' to type 'VMware.Vim.VmwareDistributedVirtualSwitch'.
At line:1 char:13
+ Get-VDSwitch <<<< -VMHost myhost.example.com
+ CategoryInfo : NotSpecified: (:) [Get-VDSwitch], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Vds.Commands.GetVDSwitch
Isn't that to be expected, since dvSwitch is a vCenter feature ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The intention is to put it in a try/catch to see if an ESXi node is joined to an n1k along the lines of what Compton94 is trying to do. Do you have a suggestion for how to check if an ESXi server is joined to an n1k?
I don't have a N1K handy right now, but does this list the connected ESXi hosts per N1K ?
foreach($dvs in Get-VDSwitch){
Get-View -Id ($dvs.ExtensionData.Config.Host | %{
$_.Config.Host}) |
Select @{N="dvSw";E={$dvs.Name}},@{N="ESX";E={$_.Name}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This looks like its going to work great, thanks LucD!
Thanks LucD, I am trying it out now and will update and let you know...
thanks
Matt
LucD,
thanks this is working the way that I want. thanks a lot.
Matt
Nice one LucD! I tested this on a wide variety of 1000v deployments (vCenter 5.0 and 5.1, and ESXi hosts at 4.1 and 5.1). Works perfectly.
Thanks for the feedback.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference