Hi Everyone. I would like to share a basic but working PowerShell script to clean up the Windows 2016 Start Menu (from ProgramData and Default User) and the Public Desktop. This is useful when using a Workspace Manager like RES or Citrix WEM. I've added this script at shutdown (local GPO) so we do not need to manually clean-up the folders after every application update or new installations.

#Start Menu Clean-up at Shutdown 

Robocopy "C:\ProgramData\Microsoft\Windows\Start Menu\Programs" "C:\StartMenu\ProgramData\Programs"  /e /is /move /xj /r:0 
New-Item "C:\ProgramData\Microsoft\Windows\Start Menu\Programs" -ItemType "directory"
Robocopy "C:\StartMenu\ProgramData\Programs\Administrative Tools" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools" /e /xj /r:0 

Robocopy "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" "C:\StartMenu\Default\Programs" /e /is /move /xj /r:0 
New-Item "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" -ItemType "directory"

#Desktop clean-up at shutdown

Robocopy "C:\Users\Public\Desktop" "C:\StartMenu\Public\Desktop" /e /is /move /xj /r:0 
New-Item "C:\Users\Public\Desktop" -ItemType "directory"
Robocopy "C:\Users\Default\Desktop" "C:\StartMenu\Default\Desktop" /e /is /move /xj /r:0 
New-Item "C:\Users\Default\Desktop" -ItemType "directory"

Open in new window


Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month