Saturday, July 24, 2021

PowerCLI script to rename datastores

PowerCLI script to rename datastores

 

Connect-VIServer vcenterserver

$input = Import-Csv C:\Temp\rename.csv

foreach ($row in $input)

{

    $CurrentDSName=$row.CurrentDSName

    $ModifiedDSName=$row.ModifiedDSName

    Get-Datastore -Name $CurrentDSName | Set-Datastore -Name $ModifiedDSName

}

Disconnect-VIServer vcenterserver -Confirm:$false


<#

Content of rename.csv

CurrentDSName,ModifiedDSName

DS1,DS01

DS2,DS02

DS3,DS03

#>

No comments:

Post a Comment