Hyper-V: De-register Storage File Share and/or Removing Paths from VMM

$pathSearch='\\DECOMMISSIONED-FILESHARE008'
$unregister=$true
$remove=$false

$fileShares=Get-SCStorageFileShare|?{$_.SharePath -like "*$pathSearch*"}
$thisLibraryServer = Get-SCLibraryServer
if($unregister){$fileShares|%{Unregister-SCStorageFileShare -StorageFileShare $_ -LibraryServer $thisLibraryServer}}
if($remove){$fileShares|%{Remove-SCStorageFileShare -StorageFileShare $_}}

# Un-resolvable errors due to certain decommed dependencies being unavailable for VMM to make changes
# Unregister-SCStorageFileShare : The file share is not associated to (Error ID: 26187)
# Remove-SCStorageFileShare : The file share could not be removed because it is not currently managed by VMM. (Error ID: 26240)

Leave a Reply

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