This is a cross post from TechNet. I don't think they want to mess with it anymore so I'm looking elsewhere for assistance.
I developed a script to assist our UserAdmins with creation of AD user accounts and create home folders on the server shares. I am encountering an issue with the recycle bin becoming corrupt when the user first logs in. This script must be run with an elevated account with permissions to the share. The home folder is created using:
New-Item-ItemTypeDirectory-Force-Path $directory
If I log into my machine as my elevated account and run powershell/powershell_ise, all is well. The recycle bin displays as "Recycle Bin" with the correct icon image
However, if I log into my machine with my non-elevated account and select "Run as a different user" for Powershell or Powershell_ISE and use my same elevated account from above the users receive "corrupt" recycle bin errors when logging in initially. Additionally, recycle bin is now listed as "$Recyle.Bin" and is using a folder icon. This issue is resolved by removing the users AD account from the home folder permissions and re-adding it with identical permissions.
I see this behavior using Win8.1 x64 as well as Win7 x64 Enterprise.
The only difference in the 2 scenarios is how PowerShell is being run, either "run as different user" or not. Permissions on the parent folder as well as the recycle bin are identical in both scenarios.
Any help is appreciated.