Function to rename the local datastore of a new installed ESXi

This is a small function to rename the local datastore of a fresh installed ESXi server from datastore1 to SERVERNAME-local.

function renameds {
	$vmHost = Get-VMHost -Name $ServerIP
	$dsname = $vmHost + "-local"
	Get-Datastore -Name datastore* | Set-Datastore -Name $dsname

3 thoughts on “Function to rename the local datastore of a new installed ESXi

  1. So what happens if the host has 2 or more local datastores, both containing the text “datastore”? Seems like anything above the first would fail with an attempt to duplicate the name.

    1. Correct the coding is only valid for 1 local datastore. But it is easy to extend the script for multiple datastores. For example you could first get all datastores from the ESXi write them into an array and afterwards change the name of each datastore (servername-local-1, servername-local-2).

  2. Hello, you used to write magnificent, but the last several posts have been kinda boring… I miss your great writings. Past few posts are just a little bit out of track! come on!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.