Connecting a Storage Space: connect-virtualdisk error PermissionDenied 40001

5,856

Can you confirm that the storage pool is not set to read-only mode? Windows seems to mark the storage pools and virtual disks as read only when it detects the pool has moved from the OS that made it.

This should return storage pool attributes:

Get-Storagepool | fl *

If the IsReadOnly attribute is set to true you should be able to change that in powershell through:

Set -StoragePool -FriendlyName -IsReadOnly $false

This has allowed me to access virtual disks that have since moved between servers in the past.

** This is something I've only done when I've moved disks from one 2012R2 system to another with the intention of reusing the disks but forgot to delete the virtual disk/storage pool before moving the disks. By setting the read only flag to false I've been able to get past the storage spaces protection on the disks to format them. I HAVE NOT had the need to preserve any data between the move and thus have not checked data integrity after performing those steps.

The original thread I followed when I encountered access problems:

http://social.technet.microsoft.com/Forums/windowsserver/en-US/917aab3a-4e56-4dbe-af2d-2374facd71f8/migrate-storage-pool-between-servers?forum=winserver8gen

Share:
5,856

Related videos on Youtube

Ed_Sullivan
Author by

Ed_Sullivan

Updated on September 18, 2022

Comments

  • Ed_Sullivan
    Ed_Sullivan over 1 year

    I'm trying to attach a storage space in my server but am receiving and access denied error. The back story is that the storage space was working fine on windows home server 2012, but then I paved the system drive (not part of the storage space) and installed a fresh copy of WHS2012 R2. The storage space no longer appears to be available. Any idea how the permissions can be fixed?

    PS C:\Users\Admin> get-virtualdisk
    
    FriendlyName        ResiliencySettingNa OperationalStatus   HealthStatus        IsManualAttach                     Size
                        me
    ------------        ------------------- -----------------   ------------        --------------                     ----
    Documents           Mirror              Detached            Unknown             True                            1.81 TB
    
    
    PS C:\Users\Admin> connect-virtualdisk -FriendlyName "Documents"
    connect-virtualdisk : Access denied
    At line:1 char:1
    + connect-virtualdisk -FriendlyName "Documents"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : PermissionDenied: (StorageWMI:ROOT/Microsoft/...SFT_VirtualDisk) [Connect-VirtualDisk],
    CimException
        + FullyQualifiedErrorId : StorageWMI 40001,Connect-VirtualDisk
    

    EDIT: For those coming after me, see this artcle: http://windowsitpro.com/systems-management/q-after-i-reinstalled-windows-server-2012-my-storage-spaces-are-no-longer-writabl

    Note the important step about set-virtualdisk -IsManualAttach $False to get the storage space to automatically show up.

  • Ed_Sullivan
    Ed_Sullivan over 10 years
    This was exactly my problem, the storage pool was read only. I had to run the command prompt as admin to make it read write, but after that I was able to successfully run connect-virtualdisk and now I see the storage pool in My Computer. I couldn't possibly thank you enough with the bounty, buy you a beer? :)
  • R.K
    R.K over 10 years
    Glad it worked :). First time I ran into this ended up putting disks into a windows 7 machine to reformat the disks because even that is blocked by storage spaces.