PowerCLI

 View Only
  • 1.  powershell Get network information from IDRAC

    Posted Jan 10, 2022 07:12 AM

    Hello,

    Could someone please help me to get the powershell script to fetch the adapter details from IDRAC.

    Appreciate your help !

     

    roopali1_0-1641798653174.png

     



  • 2.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 07:39 AM

    Ciao 

    You  try this commands (You must have the SSH service enabled on the ESXi server):

    $cred = Get-Credential

    $cmd = "localcli hardware ipmi bmc get"

    $session = New-SSHSession -ComputerName <hostname ESXi> -Credential $cred –AcceptKey

    $result = Invoke-SSHCommand -SSHSession $session -Command $cmd

    $result.Output



  • 3.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 09:15 AM

    Thanks for the help, 

    I'm getting below error, could you pls assist.

     

    PS C:\> $cred = Get-Credential
    >> $cmd = "localcli hardware ipmi bmc get"
    >> $session = New-SSHSession -ComputerName <xyz> -Credential $cred -AcceptKey
    >> $result = Invoke-SSHCommand -SSHSession $session -Command $cmd
    >> $result.Output
    >>

    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:
    Credential
    New-SSHSession : The term 'New-SSHSession' is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At line:3 char:12
    + $session = New-SSHSession -ComputerName <xyz> -Cr ...
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (New-SSHSession:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Invoke-SSHCommand : The term 'Invoke-SSHCommand' is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At line:4 char:11
    + $result = Invoke-SSHCommand -SSHSession $session -Command $cmd
    + ~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Invoke-SSHCommand:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException



  • 4.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 09:39 AM

    Ciao 

    Check if you have installed the Posh-SSH powershell module:

    Find-Module Posh-SSH

    fabio1975_0-1641807060722.png

    If it is not installed try following these instructions:

    PowerShell Gallery | Posh-SSH 3.0.0

    Otherwise, you can simply connect in SSH (once the service is enabled) to the ESXi server and run the command "localcli hardware ipmi bmc get"
    As an SSH client, you can use putty or even the PowerShell

    fabio1975_1-1641807456080.png

    fabio1975_2-1641807507266.png

     

     

     



  • 5.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 09:48 AM

    Thanks a lot, i'm afraid to say it seems i'll not get the information i'm looking for.

    Actually i need to know if adapter is supporting 10gbe or 25gbe, also how many ports are in use currently, As i have highlighted in snapshot at the beginning.



  • 6.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 10:09 AM

    Ciao,

    Ok, sorry but I understood the question wrongly
    Have you tried using the following command directly from the ESXi host (once connected in SSH)

    esxcli network nic list

    fabio1975_0-1641809317136.png

     

    or if you use the powercli 

    $cred = Get-Credential
    $esx = "<esxi host>"
    Connect-VIServer $esx -Credential $cred
    $esxcli = Get-EsxCli -VMHost $esx -V2
    $esxcli.network.nic.list.Invoke()

     

    I took a look at the card model, I would say it only supports 10 Gbs



  • 7.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 10:18 AM

    Thanks for the quick response, 

    Yes i do have this information available. But still i need to check total number of ports are available. 



  • 8.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 10:29 AM

    Hello
    what do you mean by the available ports (The ports with insert GBIC/SFP)?

    The card model you indicated, if I remember correctly, has 2 ports at 10GB and 2 ports at 1GB



  • 9.  RE: powershell Get network information from IDRAC

    Posted Jan 10, 2022 10:19 AM

    I've reported your thread so a moderator can move it to the area for PowerCLI.