A situation may arise when you have numerous shares and would like to automate the process of adding them as volumes target.
Solution:
You need to get the list of shares to be added in a CSV file and use the CSV file in the powershell script as below:
For adding Volumes:
Import-Csv "D:\Automate\shares.csv" | ForEach-Object {New-EVFSAVolume -SiteId 140B195A622AB1547B55DA4F7419C029A1d10000YBLDAKFSA02 -Name $_.sharename -FileServerId 13C524E0F29B1CB4B858ADB900019487B1z10000YBLDAKFSA02 -PolicyId 12F61FDA558063F4089D4C4CDE342AB6B1t10000YBLDAKFSA02 -VaultStoreId 1711C9AFA39414B45B8968E3059F6DEC81210000YBLDAKFSA02 -TaskId 1A16D971D64BCA846BD3A7818CA70F64F1012f00YBLDAKFSA02}
For adding Folder:
Import-Csv "D:\Automate\folder.csv" | ForEach-Object {New-EVFSAFolder -Fileserver \\*********** -Volume $_.volumename -FolderRelativePath \}
Note: To get the appropriate values for ‘SiteID, FileserverID, VaultstoreID, PolicyID and TaskID’ run the commands Get-Evsite, Get-EVFSAvolume and Get-EVFSAFileServer in Enterprise Vault Management Shell.
Also, ensure that the CSV file name and column name be matching exactly like that used in the script.