Product, version and build: PowerShell Studio 2015 4.2.99
32 or 64 bit version of product: 64 bit
Operating system: Windows 7 Enterprise
32 or 64 bit OS: 64
To start, I should mention that I have a license for PowerShell Studio 2012. However, I was getting a different error message on the same portion of this script, which I will post about in a seperate forum. However, that error prompted me to try the 2015 trial, as I thought that using PowerShell v4 might help, which it sort of did.
Basically, I am trying to use the NTFSSecurity module to make some permissions changes to a folder. I will need to add a group and 2 remove 2 other ACL entries. I have tested the script in the PowerShell ISE, and it works fine. However, when I try the exact same code in PowerShell Studio, I get an UnauthorizedAccessException. Is there anything I can do to troubleshoot/get this working?
The code looks like this:
Import-Module "$Source\assets\powershell\NTFSSecurity"
Disable-NTFSAccessInheritance -Path $Dest
Add-NTFSAccess -Path $Dest -AccessRights FullControl -Account $GroupName
NTFSSecurity module - UnauthorizedAccessException when trying to add access
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NTFSSecurity module - UnauthorizedAccessException when trying to add access
The ISE usually runs elevated. In PowerShell Studio there is a button on the ribbon to run your script elevated.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NTFSSecurity module - UnauthorizedAccessException when trying to add access
Just out of curiosity, where did you obtain a 2015 trial and why did you not try the latest version (2017)?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: NTFSSecurity module - UnauthorizedAccessException when trying to add access
Double checked, ISE is not running elevated.
I updated my registered version of Studio 2012 and now I am getting the same error in that version.
I updated my registered version of Studio 2012 and now I am getting the same error in that version.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NTFSSecurity module - UnauthorizedAccessException when trying to add access
I sincerely doubt (albeit did not verify) that you can change a folders access permission without elevation. Even in Windows 7 you would have to have UAC completely disabled.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: NTFSSecurity module - UnauthorizedAccessException when trying to add access
It looks like it is possible as long as you have the appropriate permissions or are the owner of the folder. Because the script creates the folder as well, the user who will be setting the permissions is also the owner. Is there a way that I can post verification that it works as described?
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NTFSSecurity module - UnauthorizedAccessException when trying to add access
"Is there a way that I can post verification that it works as described?" I am not sure what that means. Can you please elaborate?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.