2
votes

I have a SAN volume mounted to a directory on a Windows 2008R2 server and I'd like to get and set the ACLs on that disk device using powershell. If I do the following I get the permissions of the directory the disk is mounted to instead of the permissions on the drive:

Get-Acl C:\shares\PS-TEST

I've tried the following but with no such luck:

Get-Acl \\?\PhysicalDrive19

What do I have to do to {Get,Set}-ACL on the disk device instead of the mount point folder?

1

1 Answers

1
votes

Use the following for getting an ACL object.

$aclObject = [io.directory]::GetAccessControl("\\.\PHYSICALDRIVE0")

Use the following for setting an ACL object.

[io.directory]::SetAccessControl("\\.\PHYSICALDRIVE0",$aclObject)