Forum Discussion
Disable GPO folder redirection.
Hi John,
Can you share any guide / details about how you managed to solve it ?
kind regards
Syed Mobeen Kazmi
I know this super old, but in our environment, it added multiple registry entries for some of the folders. This is the script I came up with that i'm going to attempt to run as a login script. It looks good in testing so far. Had desktop/documents/picture/favorites/downloads in it
# Login Script for Folder Redirection
# Get the current user's profile path
$userProfilePath = [Environment]::GetFolderPath("UserProfile")
# List of folders to check and create
$folders = @('Desktop', 'Documents', 'Pictures', 'Favorites', 'Downloads')
# For each folder, check and create if necessary, then update registry
foreach ($folder in $folders) {
$folderPath = Join-Path -Path $userProfilePath -ChildPath $folder
# Check if folder exists
if (-not (Test-Path -Path $folderPath)) {
# Create the folder
New-Item -Path $folderPath -ItemType Directory -Force
}
# Registry paths for User Shell Folders
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
# Update the registry to point to the new folder path
switch ($folder) {
'Desktop' { Set-ItemProperty -Path $regPath -Name '{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}' -Value '%USERPROFILE%\Desktop' }
'Desktop' { Set-ItemProperty -Path $regPath -Name 'Desktop' -Value '%USERPROFILE%\Desktop' }
'Documents' { Set-ItemProperty -Path $regPath -Name '{F42EE2D3-909F-4907-8871-4C22FC0BF756}' -Value '%USERPROFILE%\Documents' }
'Documents' { Set-ItemProperty -Path $regPath -Name 'Personal' -Value '%USERPROFILE%\Documents' }
'Pictures' { Set-ItemProperty -Path $regPath -Name '{0DDD015D-B06C-45D5-8C4C-F59713854639}' -Value '%USERPROFILE%\Pictures' }
'Pictures' { Set-ItemProperty -Path $regPath -Name 'My Pictures' -Value '%USERPROFILE%\Pictures' }
'Favorites' { Set-ItemProperty -Path $regPath -Name 'Favorites' -Value '%USERPROFILE%\Favorites' }
'Downloads' { Set-ItemProperty -Path $regPath -Name '{374DE290-123F-4565-9164-39C4925E467B}' -Value '%USERPROFILE%\Downloads' }
'Downloads' { Set-ItemProperty -Path $regPath -Name '{7D83EE9B-2244-4E70-B1F5-5393042AF1E4}' -Value '%USERPROFILE%\Downloads' }
}
}