Automation

 View Only
  • 1.  Change nfspath for datastore for multiple vhosts

    Posted May 21, 2020 06:58 PM

    Our NFS path has changed for a vcenter / datastore.

    Old path: /xyz

    New path /vol/xyz

    If I were adding a new datastore I'd go with the following:

    $nfshost = "172.22.225.97"

    $nfspath = "/vol/xyz"

    $servers = get-content <filename> <-- list of virtual host names

    foreach ($server in $servers) {

      

        ""

        "Adding NFS Datastores to ESX host: $server"

        "-----------------"

        "<datastore name>"

        New-Datastore -VMHost $server -Name "<datastore name>" -Nfs -NfsHost $nfshost -Path $nfspath

    }

    How do I rename / reset the nfs path for an existing datastore? Is this possible with Set-Datastore?



  • 2.  RE: Change nfspath for datastore for multiple vhosts
    Best Answer

    Posted May 21, 2020 07:10 PM

    I'm afraid not.
    Afaik there is no API method either to reconfigure a datastore.

    The only way I can think of, is to remove the datastore and create a new one with the new configuration parameters.



  • 3.  RE: Change nfspath for datastore for multiple vhosts

    Posted May 21, 2020 07:21 PM

    Thanks Luc. Not the answer I wanted but easy enough.