Skip to main content

Powershell Change NTFS permissions

Help i am getting the error: Set-Acl : The security identifier is not allowed to be the owner of this object.

If you were getting this error with your script please see the reason below.

The error is failing to change the folder’s ownership (even though you don't want to)– very frustrating! Microsoft explanation:

“Unfortunately Get-ACL is missing some features. It always reads the full security descriptor even if you just want to modify the DACL. That’s why Set-ACL also wants to write the owner even if you have not changed it. Using the GetAccessControl method allows you to specify what part of the security descriptor you want to read”

The key line is: $acl = (Get-Item $path).GetAccessControl("Access")

How to add 'modify' access to the group 'Users' using Powershell sucessfully

$username = "Users"
$path = "C:\Program Files (x86)\Java"
$acl = (Get-Item $path).GetAccessControl("Access")
$accessrule = New-Object system.security.AccessControl.FileSystemAccessRule($username, "Modify", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.AddAccessRule($accessrule)
set-acl -aclobject $acl $path

 

 

 

Comments

  1. Data recovery in Dubai is a process that restores data from storage media such as hard disks, USB drives, and memory cards. It is usually done when data is lost due to hardware failure, malfunctioning devices, or human error. For Data Repairing Services contact us at +97145864033.

    ReplyDelete

Post a Comment

Popular posts from this blog

Windows 7 Offline files will not go Online when connected to network

Issue Several laptop users move between networks, domain, home, etc and when they attempt to access DFS shares explorer status is working offline.  The issue only resolves it self after a reboot. Connecting directly to the share works and i am able to ping network resources.  This behavior occurs for VPN users as well. Possible Causes "slow-link mode". In win7 (with default settings) a client will enter slow-link mode if the latency to the server is above 80ms. In slow-link mode all writes are made to the local cache and a background sync only happens every 6 hours.  Depending on your connection the default slow link detection speed is 64,000 bps On client computers running Windows 7 or Windows Server 2008 R2, a shared folder automatically transitions to the slow-link mode if the round-trip latency of the network is greater than 80 milliseconds, or as configured by the "Configure slow-link mode" policy. After transitioning a folder to the slow-link mode, Offline Fil...

SCCM Unknown computer not able to see Task Sequences after installing Current Branch 1702

Soon after installing SCCM CB 1702 we were unable to see Task Sequences deployed to the unknown collection. This issue was identified as a random system taking the GUID of the 'x64 Unknown Computer (x64 Unknown Computer)' record. As a result it was now a known GUID; as we were only deploying Task Sequences to the Unknown collection none were made available. 'x64 Unknown Computer (x64 Unknown Computer)' record 'x86 Unknown Computer (x86 Unknown Computer)' record To get the GUID of your unknown systems open SQL management studio and run the following command: --Sql Command to list the name and GUID for UnknownSystems record data select ItemKey, Name0,SMS_Unique_Identifier0 from UnknownSystem_DISC Using the returned GUID (SMS_Unique_Identifier0) we can find the hostname that has been assigned the 'x64 Unknown Computer (x64 Unknown Computer)' GUID by running the query below. --x64 Unknown Computers select Name0,SMS_Unique_Identifier0,Decommissioned0 from Sys...

SCCM - Change the drive used for offline servicing of OSD images

Change the drive used for offline servicing of OSD images Offline Servicing OSD images wihin SCCM is a useful feature.  I have heard SCCM Professional say it is good and bad but this post is is specifically around changing the default location used to stage the Windows image. By default SCCM will use the drive in which the Configuration Manager is installed (i.e. Drive E) even if it is running low on diskspace.  But assuming you have a new drive F: with plenty of space the procedure below will details how to change this. Assuming your site code is P01 Launch wbemtest.exe and connect to:  root\sms\site_P01 Click Query and enter: SELECT * FROM SMS_SCI_Component WHERE SiteCode=’P01’ AND ItemName LIKE ‘SMS_OFFLINE_SERVICING_MANAGER%’ Double click the  query result Double click Props (Scroll down second from bottom) Click View Embedded There will be four entries listed. Through a process of trial and error double click each one looking for PropertyName...