# PowerShell Library

**URL:** https://community.netwrix.com/c/community/resources/powershell-library/254.md

[Latest](https://community.netwrix.com/latest.md) · [Categories](https://community.netwrix.com/categories.md) · [Tags](https://community.netwrix.com/tags.md)

---

## [Introduction to Windows PowerShell](https://community.netwrix.com/t/introduction-to-windows-powershell/120813)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:44pm UTC](https://community.netwrix.com/t/introduction-to-windows-powershell/120813 "2026-01-13T18:44:28Z")

</div>

Automate it. Now, where’s that script… Warning: PowerShell is addictive Windows PowerShell is an object-oriented automation engine and scripting language with an interactive command-line shell designed to help IT profe…

---

## [About the PowerShell Library category](https://community.netwrix.com/t/about-the-powershell-library-category/120800)

<div class="topic-metadata">

**Author:** [@derek.putnam](https://community.netwrix.com/u/derek.putnam)\
**Replies:** 0

</div>

---

## [AD Object Counter: A Free PowerShell GUI Tool for Counting Enabled Directory Users and Computers](https://community.netwrix.com/t/ad-object-counter-a-free-powershell-gui-tool-for-counting-enabled-directory-users-and-computers/128336)

<div class="topic-metadata">

**Author:** [@jeremy.moskowitz](https://community.netwrix.com/u/jeremy.moskowitz)\
**Replies:** 0\
**Last updated:** [April 15, 2026, 8:53pm UTC](https://community.netwrix.com/t/ad-object-counter-a-free-powershell-gui-tool-for-counting-enabled-directory-users-and-computers/128336 "2026-04-15T20:53:59Z")

</div>

AD Object Counter: A Free PowerShell GUI Tool for Counting Active Directory Users and Computers If you manage Active Directory, you’ve almost certainly been asked some version of this question: “How many active users a…

---

## [Looking for a PDF version of the PowerShell Library?](https://community.netwrix.com/t/looking-for-a-pdf-version-of-the-powershell-library/121274)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 20, 2026, 7:46pm UTC](https://community.netwrix.com/t/looking-for-a-pdf-version-of-the-powershell-library/121274 "2026-01-20T19:46:16Z")

</div>

Look no further! You can download it here: \[marketo-form id=1309 pdf=“upload://k5sOhPlOV9sVQvWnuxnICeYzwCd.pdf”\]

---

## [Changing File and Folder Ownership](https://community.netwrix.com/t/changing-file-and-folder-ownership/120851)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/changing-file-and-folder-ownership/120851 "2026-01-13T21:23:56Z")

</div>

If you want to set an owner for a folder, you need to run the SetOwner method. Let’s make “ENTERPRISE\\J.Carter” the owner of the “Sales” folder: $acl = Get-Acl \\\\fs1\\shared\\sales $object = New-Object System.Security.Pri…

---

## [Enabling and Disabling Permissions Inheritance](https://community.netwrix.com/t/enabling-and-disabling-permissions-inheritance/120850)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/enabling-and-disabling-permissions-inheritance/120850 "2026-01-13T21:23:53Z")

</div>

NTFS permissions can be either explicit or inherited. Explicit permissions are permissions that are configured individually, while inherited permissions are inherited from the parent folder. The hierarchy for permission…

---

## [Removing User Permissions](https://community.netwrix.com/t/removing-user-permissions/120849)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/removing-user-permissions/120849 "2026-01-13T21:23:50Z")

</div>

To remove permissions, use the RemoveAccessRule parameter. Let’s delete the “Allow FullControl” permission for T.Simpson to the “Sales” folder: $acl = Get-Acl \\\\fs1\\shared\\sales $AccessRule = New-Object System.Security.…

---

## [Setting File and Folder Permissions](https://community.netwrix.com/t/setting-file-and-folder-permissions/120848)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/setting-file-and-folder-permissions/120848 "2026-01-13T21:23:48Z")

</div>

In order to implement a least-privilege model, which is a best practice for system security, IT security specialists and system administrators configure NTFS access control lists (ACLs) by adding access control entries (…

---

## [Renaming Files](https://community.netwrix.com/t/renaming-files/120847)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/renaming-files/120847 "2026-01-13T21:23:45Z")

</div>

The Rename-Item cmdlet enables you to change the name of an object while leaving its content intact. It’s not possible to move items with the Rename-Item command; for that functionality, you should use the Move-Item cmdl…

---

## [Moving Files and Directories](https://community.netwrix.com/t/moving-files-and-directories/120846)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/moving-files-and-directories/120846 "2026-01-13T21:23:43Z")

</div>

The Move-Item cmdlet moves an item, including its properties, contents, and child items, from one location to another. It can also move a file or subdirectory from one directory to another location. The following comman…

---

## [Copying Files and Folders](https://community.netwrix.com/t/copying-files-and-folders/120845)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/copying-files-and-folders/120845 "2026-01-13T21:23:40Z")

</div>

The Copy-Item cmdlet enables you to copy objects from one path to another. The following command creates a backup by copying the file users.xlsx from one remote computer (fs) and saving it to another (fs2) over the netwo…

---

## [Deleting Files and Folders](https://community.netwrix.com/t/deleting-files-and-folders/120844)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/deleting-files-and-folders/120844 "2026-01-13T21:23:38Z")

</div>

To delete objects, use the Remove-Item cmdlet. If the object is not empty, you’ll be prompted to confirm the deletion. Here’s how to delete the “IT” folder and all the subfolders and files inside it: Remove-Item -Path '…

---

## [Creating Files and Folders](https://community.netwrix.com/t/creating-files-and-folders/120843)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/creating-files-and-folders/120843 "2026-01-13T21:23:35Z")

</div>

To create new objects with Windows PowerShell, you can use the New-Item cmdlet and specify the type of item you want to create, such as a directory, file or registry key. For example, this command creates a folder: New-…

---

## [Viewing Objects in a Directory](https://community.netwrix.com/t/viewing-objects-in-a-directory/120842)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 9:23pm UTC](https://community.netwrix.com/t/viewing-objects-in-a-directory/120842 "2026-01-13T21:23:32Z")

</div>

To view the content of a directory on a Windows file server, use the Get-ChildItem cmdlet. To show all hidden files, add the -Force parameter. The command below shows all root objects in the Shared folder: Get-ChildItem…

---

## [PowerShell Pipeline](https://community.netwrix.com/t/powershell-pipeline/120835)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:55pm UTC](https://community.netwrix.com/t/powershell-pipeline/120835 "2026-01-13T18:55:12Z")

</div>

A pipe passes data from one cmdlet to another. We used a pipe earlier to get all the properties of an object. Basic Pipe Usage For example, if you execute the following script, you’ll get all services sorted by their st…

---

## [PowerShell Comments and Documentation](https://community.netwrix.com/t/powershell-comments-and-documentation/120834)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:55pm UTC](https://community.netwrix.com/t/powershell-comments-and-documentation/120834 "2026-01-13T18:55:09Z")

</div>

Leaving comments in a script will help you — and your colleagues — better understand what the script does. Types of Comments String Comments A string comment is a single line that starts with a number sign (#): # that …

---

## [Running PowerShell Scripts with Task Scheduler](https://community.netwrix.com/t/running-powershell-scripts-with-task-scheduler/120833)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/running-powershell-scripts-with-task-scheduler/120833 "2026-01-13T18:52:55Z")

</div>

Task Scheduler can help you automatically launch a program or PowerShell script at a certain time or when certain conditions are met. You can also schedule sending emails and even displaying certain messages. To create …

---

## [Creating Scheduled Tasks with PowerShell Scripts](https://community.netwrix.com/t/creating-scheduled-tasks-with-powershell-scripts/120832)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/creating-scheduled-tasks-with-powershell-scripts/120832 "2026-01-13T18:52:52Z")

</div>

Suppose that each day at 10 AM, we want to execute a PowerShell script that monitors changes to group membership in an Active Directory site. In Windows PowerShell 2.0 (Windows 7 or Windows Server 2008 R2), to create a …

---

## [Managing NTFS Permissions with PowerShell](https://community.netwrix.com/t/managing-ntfs-permissions-with-powershell/120830)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/managing-ntfs-permissions-with-powershell/120830 "2026-01-13T18:52:47Z")

</div>

This comprehensive guide covers all aspects of NTFS permissions management using PowerShell. Prerequisites If you’re not familiar with NTFS permissions management, check out the NTFS Permissions Management Best Practice …

---

## [Basic File and Folder Operations](https://community.netwrix.com/t/basic-file-and-folder-operations/120829)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/basic-file-and-folder-operations/120829 "2026-01-13T18:52:44Z")

</div>

This guide covers the fundamental file system operations in PowerShell. Viewing Objects in a Directory To view the content of a directory on a Windows file server, use the Get-ChildItem cmdlet. Basic Usage Get-ChildIte…

---

## [Moving Users and Computers to a New Organizational Unit](https://community.netwrix.com/t/moving-users-and-computers-to-a-new-organizational-unit/120827)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/moving-users-and-computers-to-a-new-organizational-unit/120827 "2026-01-13T18:52:39Z")

</div>

The PowerShell Move-ADObject cmdlet moves any object or set of objects (such as a user, a computer, a group or an OU) to a specified OU. The -Identity parameter specifies which Active Directory object or container to mov…

---

## [Removing Users and Computers from a Group](https://community.netwrix.com/t/removing-users-and-computers-from-a-group/120826)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/removing-users-and-computers-from-a-group/120826 "2026-01-13T18:52:36Z")

</div>

To remove a user from a group, use the Remove-ADGroupMember cmdlet: Remove-ADGroupMember -Identity Quality -Members J.Robinson To remove a computer account from a group, specify the computer name with a dollar sign ($)…

---

## [Adding Users and Computers to a Group](https://community.netwrix.com/t/adding-users-and-computers-to-a-group/120825)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/adding-users-and-computers-to-a-group/120825 "2026-01-13T18:52:33Z")

</div>

You can add users, computers, and even other groups to AD groups with the Add-AdGroupMember cmdlet. Adding Users to a Group Single User Add one user to a group: Add-AdGroupMember -Identity Quality -Members B.Jackson M…

---

## [Creating and Deleting an Active Directory Group](https://community.netwrix.com/t/creating-and-deleting-an-active-directory-group/120824)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/creating-and-deleting-an-active-directory-group/120824 "2026-01-13T18:52:30Z")

</div>

In Active Directory, access to network resources is granted to security principals, such as user accounts and computer accounts, and those permissions can change over time. To simplify access management and improve secur…

---

## [Deleting a Computer from Active Directory](https://community.netwrix.com/t/deleting-a-computer-from-active-directory/120823)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/deleting-a-computer-from-active-directory/120823 "2026-01-13T18:52:28Z")

</div>

To delete a computer account from AD, use the Remove-ADObject cmdlet: Remove-ADObject -Identity "WKS932" You will be prompted to confirm the deletion. Deleting Multiple Computers from a List If you have a text file wi…

---

## [Disabling User and Computer Accounts](https://community.netwrix.com/t/disabling-user-and-computer-accounts/120822)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/disabling-user-and-computer-accounts/120822 "2026-01-13T18:52:25Z")

</div>

To disable user, computer or service accounts, use the Disable-ADAccount cmdlet. The –Identity parameter specifies which account to disable. You can specify an account by its distinguished name, security identifier (SIDs…

---

## [Resetting a Computer Account](https://community.netwrix.com/t/resetting-a-computer-account/120821)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/resetting-a-computer-account/120821 "2026-01-13T18:52:22Z")

</div>

Like a user account, a computer account interacts with Active Directory using a password. But for computer accounts, a password change is initiated every 30 days by default and the password is exempted from the domain’s …

---

## [Renaming a Computer](https://community.netwrix.com/t/renaming-a-computer/120820)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/renaming-a-computer/120820 "2026-01-13T18:52:20Z")

</div>

To change a computer name, use the Rename-Computer cmdlet. Note that the computer must be online and connected to Active Directory. Basic Syntax Rename a computer remotely: Rename-Computer –ComputerName "FS1" -NewName …

---

## [Joining a Computer to a Domain and Removing a Computer from a Domain](https://community.netwrix.com/t/joining-a-computer-to-a-domain-and-removing-a-computer-from-a-domain/120819)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/joining-a-computer-to-a-domain-and-removing-a-computer-from-a-domain/120819 "2026-01-13T18:52:17Z")

</div>

Joining a Computer to a Domain (Locally) To join a PC to an Active Directory domain, run the following PowerShell script locally on the computer: $dc = "ENTERPRISE" # Specify the domain to join $pw = "Password123" | Con…

---

## [Creating New User and Computer Accounts](https://community.netwrix.com/t/creating-new-user-and-computer-accounts/120818)

<div class="topic-metadata">

**Author:** [@Netwrix-Team](https://community.netwrix.com/u/Netwrix-Team)\
**Replies:** 0\
**Last updated:** [January 13, 2026, 6:52pm UTC](https://community.netwrix.com/t/creating-new-user-and-computer-accounts/120818 "2026-01-13T18:52:14Z")

</div>

You can create new user accounts in Active Directory using the New-ADUser cmdlet. This guide covers single account creation, bulk creation, and importing from CSV files. Getting the Syntax To get the full syntax for the…

[Next page](https://community.netwrix.com/c/community/resources/powershell-library/254.md?page=1)
