Powershell – Update NTFS Audit Levels

Here are the required steps for updating audit rules on Windows NTFS shares with PowerShell.

 # PowerShell Script used for updating and removing NTFS Audit Rules
 # The $path variable represents the UNC path to the share that the script is being executed against.
 #
 # Comment or Un-Comment the Remove or Set rules to update a shares permissions.
get-date
 $path \\\
# Get the current ACL details
 $CurrentACL = get-acl $path
if (!($CurrentACL -eq $null)) {
# Success & Failure
 $AccessRule = new-object System.Security.AccessControl.FileSystemAuditRule("Everyone","ChangePermissions,DeleteSubdirectoriesAndFiles,Delete,TakeOwnership","ContainerInherit","None","Success,Failure")
# Remove Audit Rule
 #$CurrentACL.RemoveAuditRule($AccessRule)
# Set New Audit Rule
 #$CurrentACL.AddAuditRule($AccessRule)
# Apply New Permissions
 set-acl $path -AclObject $CurrentACL
 } else {
 Write-Host "ACL's unsuccessfully pulled from path $path"
 }
get-date

Expand NTFS Partitions

Expansion of non-dynamic NTFS partitions can be accomplished by using the Microsoft Utility called DiskPart.exe.  DiskPart allows examination of disks, volumes, and partitions. Cloning of disk and also expansion on existing partitions.

CAUTION! Use at your own risk – Disk corruption can occur if an application is using the partition while expansion is in progress.

Link to Microsofts full description of DiskPart Util
Download DiskPart Util from Microsoft

  1. Launch a command window Start -> Run
  2. type in diskpart, you will be placed at a DISKPART> prompt
  3. list disk to view all visible disks
  4. select disk <number>
  5. select volume <number>  Note you cannot expand a volume if the volume does not have extra unused space.
  6. extend volume <number> size=<number in MBs>
  7. exit exits the program…