# Using PowerShell to replace icacls

**URL:** <https://forums.powershell.org/t/using-powershell-to-replace-icacls/20423>\
**Category:** PowerShell Help\
**Created:** [September 15, 2022, 12:28am UTC](https://forums.powershell.org/t/using-powershell-to-replace-icacls/20423 "2022-09-15T00:28:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nora](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/nora/32/3930_2.png) [@nora](https://forums.powershell.org/u/nora)\
**Post date:** [September 15, 2022, 12:28am UTC](https://forums.powershell.org/t/using-powershell-to-replace-icacls/20423/1 "2022-09-15T00:28:40Z")

</div>

Hi, it’s me again! I’m very comfortable with icacls, but I’m beginning to realize that I need to transition over to PowerShell for file system administration.

In my business, a little paranoia goes a long way. Before I perform an expensive file operation, I like to make sure that everything is ok and make sure that I can revert back if something goes wrong. I usually run these two commands before making a big ACL change:

```auto
icacls "\\mydomain\users02" /verify /t /c /q
icacls "\\mydomain\users02" /t /c /q /save z:\users02_acl_backup.txt

```

The first one finds files whose ACL is not in canonical form or with a length inconsistent with the ACE count. The second allows me to back up ACL’s into a text file for later use with /restore if things go bad.

How would you accomplish these in PowerShell?

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [September 15, 2022, 2:25am UTC](https://forums.powershell.org/t/using-powershell-to-replace-icacls/20423/2 "2022-09-15T02:25:30Z")

</div>

You can run these in powershell just fine. Unless you install the NTFSsecurity module, I think you’ll find working with ACLs in powershell overly complex and cumbersome. The registry is another area where reg.exe is so much simpler in many areas.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/using-powershell-to-replace-icacls/20423/3 "2024-05-16T20:16:37Z")

</div>

Closed on May 16, 2024, 8:16pm UTC


