I have created a script that will rename pst files to acl owner. It works. The only problem i have is when there are two pst files in the same folder.It gives them the same name. How can i add an increment in my script. It ried it with Si = 1 and Si++ but with no results.
Here is my script:
Get-ChildItem C:\Users\tester\* -Filter *.pst -recurse |
ForEach-Object{
$owner = ( $_ | Get-Acl ).Owner.Split("\")[1]
$newname = "$owner.pst"
$_ | Rename-Item -NewName $newname -Verbose -WhatIf
}