



The account name, and that it is a Local Account. What information is listed for the new account?_ You can run this PowerShell script using a GPO at shutdown or with a PoSh script in Task Scheduler.6.1.2.3 Lab – Create User Accounts in Windows 8 Answers Answers 09 Write-host $LocalProfile.LocalPath, "profile deleted” -ForegroundColor Magenta Gci -force 'C:\Users'-ErrorAction Silentl圜ontinue | ? įoreach ($LocalProfile in $LocalProfiles) Instead of using the automatic cleanup profile policy described above, you can use a simple PowerShell script to find and remove profiles of disabled or inactive users.įirst of all, let’s try to count the size of all user profil folders in C:\Users using a simple script from the article Getting Directory Sizes in PowerShell: PowerShell Script to Delete Old User Profiles in Windows Also, this policy may not work if some third-party software (most often it is an antivirus) accesses NTUSER.DAT file in user profiles and updates the date of last use. The main troubles associated with this automatic method of profile removal is waiting for the server restart and non-selectivity (you cannot prohibit deleting certain user profiles like local accounts, administrative accounts, etc.).

Otherwise active user profiles may be deleted. When using this policy, make sure that when a server is shut down or restarted there are no problems with the system time (check the article “ System time and date changes after reboot”).
