Ok Folks, i answer myself.
I have found a way to get the mac-address (Fujitsu BX9xx) from snmp and write this into a csv file (.\ESX-Server-MAC-List.csv).
Hostname,IP,RSB-Name,RSB-IP,RSB-MAC,RSB-User,RSB-Pass
bcf70101.dcs,10.x.y.z,bcf70101.rsb,10.r.s.b,C8:0A:A9:57:xx:xx,user,pass
bcf70102.dcs,10.x.y.z,bcf70102.rsb,10.r.s.b,C8:0A:A9:9E:xx:xx,user,pass
And now the code -> SetIPMIfromCSV.ps1
function FindName([string] $name)
{
foreach ($obj in $IPArray)
{
if ( $obj.Hostname -eq $name )
{
return $obj;
}
}
return $NULL
}
$vcserver="xxxxxx"
$snp = Get-PSsnapin -Name VMware.VimAutomation.Core >$NULL 2>&1
if ($snp.Name -ne "VMware.VimAutomation.Core" )
{
Add-PSsnapin VMware.VimAutomation.Core >$NULL 2>&1
}
.\Initialize-PowerCLIEnvironment.ps1 >$NULL 2>&1
$srv = Connect-VIServer -server $vcserver -NotDefault
if ( $srv.Name -ne $vcserver )
{
write-Output "No connection to $vcserver ."
exit
}
Connect-VIServer $vcserver -Session $srv.SessionId >$NULL 2>&1
$IPArray = Import-Csv .\ESX-Server-MAC-List.csv
Get-VMHost -Location "Clusterxxx" | sort | % {
$esxhost = $_
$hostview = $_ | Get-View
[string] $hostname = $hostview.Name
$obj=FindName($hostname)
if ( $obj -ne $NULL)
{
$ipmi = New-Object Vmware.Vim.HostIpmiInfo
$ipmi.BmcIpAddress = $obj.'RSB-IP'
$ipmi.BmcMacAddress = $obj.'RSB-MAC'
$ipmi.Login = $obj.'RSB-User'
$ipmi.Password = $obj.'RSB-Pass'
#Write-Output $ipmi
$hostview.UpdateIpmi($ipmi)
}
}
write-Output "################################################################################"
Disconnect-VIServer -server $vcserver -confirm:$false
Remove-PSsnapin -Name VMware.VimAutomation.Core
exit
Best regards
Dirk