VMware Cloud Community
roopali1
Enthusiast
Enthusiast

powershell Get network information from IDRAC

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

 

0 Kudos
8 Replies
fabio1975
Commander
Commander

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

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

roopali1
Enthusiast
Enthusiast

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

0 Kudos
fabio1975
Commander
Commander

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

 

 

 

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

0 Kudos
roopali1
Enthusiast
Enthusiast

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.

0 Kudos
fabio1975
Commander
Commander

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

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

roopali1
Enthusiast
Enthusiast

Thanks for the quick response, 

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

0 Kudos
scott28tt
VMware Employee
VMware Employee

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

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
fabio1975
Commander
Commander

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

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

0 Kudos