< Back

Remove-ExplicitUserPermission

Fri Jan 10, 2020 6:36 pm

NAME Remove-ExplicitUserPermission



SYNOPSIS

Remove user ACEs from ACLs





SYNTAX

Remove-ExplicitUserPermission [-Username] <String[]> [-Path] <String> [[-Userdomain] <String>] [-WhatIf]

[-Confirm] [<CommonParameters>]





DESCRIPTION

This function will help you remove entries in ACLs where a user has been set instead of a group, which is

generally considered best practice.

The functions supports confirm and WhatIf and can also take pipeline input which makes it very easy to use

together with Get-ExplicitUserPermission





PARAMETERS

-Username <String[]>

Provide one or more samaccountNames in that exists in your AD. Only specified SamAccountNames will be removed



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Path <String>

Specify a path to a directory or file where you want ACEs to be removed.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Userdomain <String>

The userdomain name of your domain. If your domain is corporate.local then your userdomain will probably be

corporate. Therefor the default value vill be the userdomain of the user running the script



Required? false

Position? 3

Default value $env:USERDOMAIN

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

PSCustom Object



Username Path Action

-------- ---- ------

ITM\\robama C:\\Users\\Robama\\Desktop\\subfolder Remove





NOTES





Created by Robert Amartinesei

2017-01-20



Disclaimer: These scripts are provided in good faith and with no warranty as to their fitness of purpose. Use

this software at your own risk. The author accepts no liabiliy for any losses or damages resulting from the

use thereof.



-------------------------- EXAMPLE 1 --------------------------



PS>Get-ExplicitUserPermission -Username Robama -Path C:\\Users\\Robama\\Desktop\\subfolder -SingleItem |

Remove-ExplicitUserPermission -WhatIf



What if: Performing the operation "Remove "ITM\\robama" from ACL" on target "C:\\Users\\Robama\\Desktop\\subfolder".



This commands shows you that the functions takes pipeline input and supports the use of "WhatIf"









-------------------------- EXAMPLE 2 --------------------------



PS>Get-ExplicitUserPermission -Username Robama | Remove-ExplicitUserPermission -Verbose



Username Path Action

-------- ---- ------

ITM\\Robama C:\\users\\RObama\\folder2 Remove











RELATED LINKS