VMware Cloud Community
bchristian
Contributor
Contributor
Jump to solution

Update SCSI LUN DisplayName

Hey folks,

I'm trying to bulk update the names of the scsi LUNs (datastores and RDMs) that are presented to my ESXi cluster. I can output the information I need using the following (the example lists a single device based on filtering the canonical name):

$esxName = "myserver.mydomain.com"

$esx = Get-VMHost $esxName | Get-View

$scsiLun = $esx.Config.StorageDevice.ScsiLun | where {$_.LunType -eq "disk" -AND $_.canonicalName.substring(32) -eq "3000" }

Write-Host $scsiLun.CanonicalName $scsiLun.DisplayName

I want to update the DisplayName. I've tried $scsiLun.Set_DisplayName("test"), however it does not apply properly.

Does anyone have any suggestions?

Cheers!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I was put on the wrong foot by the script in your first post.

It's not the CanonicalName you want to change but the DisplayName property.

Since you mentioned you did it through vSphere client I realised what you were trying to do.

Yes, that can be done.

Use something like this

$esxName = <esx-hostname>
$esx = Get-VMHost $esxName | Get-View
$storSys = Get-View $esx.ConfigManager.StorageSystem
$esx.Config.StorageDevice.ScsiLun | where {$_.LunType -eq "disk"} | %{
	$storSys.UpdateScsiLunDisplayName($_.Uuid, $_.DisplayName + " test")
}

This script just adds the suffix "test" to the existing value.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Afaik you can't change this name.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
bchristian
Contributor
Contributor
Jump to solution

I was afraid that might be the case. I've got over 200 to change and the vsphere client is painful because it refreshes after each name change. I'll leave the question open for a few days in case anyone knows of another method!

Cheers.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I was put on the wrong foot by the script in your first post.

It's not the CanonicalName you want to change but the DisplayName property.

Since you mentioned you did it through vSphere client I realised what you were trying to do.

Yes, that can be done.

Use something like this

$esxName = <esx-hostname>
$esx = Get-VMHost $esxName | Get-View
$storSys = Get-View $esx.ConfigManager.StorageSystem
$esx.Config.StorageDevice.ScsiLun | where {$_.LunType -eq "disk"} | %{
	$storSys.UpdateScsiLunDisplayName($_.Uuid, $_.DisplayName + " test")
}

This script just adds the suffix "test" to the existing value.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
bchristian
Contributor
Contributor
Jump to solution

That's it! Thanks so much!

0 Kudos
ii00907
Contributor
Contributor
Jump to solution

Hi ,

I think what you have done is very usefull for me

i did not understand if rename appears on vSphere Center or host also on ESX, so no more vml.... but LUN1_12.....

You can help and pointed the way.

0 Kudos
ii00907
Contributor
Contributor
Jump to solution

Hi LucD,

i have open a discussion ,

http://communities.vmware.com/message/1578617#1578617

and i have the same needs, but on command line on esx host or vMA.

Is possible change "Device Display Name" without PowerCLI?

Thanks for your kind answer

0 Kudos