PS Script to change a registry value back to default

MTS 26 Reputation points
2022-06-23T20:02:28.647+00:00

IT have implemented a Windows Folder Redirection for all user, whereby their My Music, My Pictures and Personal folders have been redirected from the default C:\ location to \FILESERVER\User$user.name\My Documents location. These settings are tattooed in the registry and not easily changed; these settings can be found in the registry here Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

i need to change that registry value(S) back to default using a script as part of the stage in the migration process can anyone help

i need to

Remove users from the redirection GPO

deploy a PS script using Intune or Group Policy to rewrite the registry keys to default

im looking for assistance with the script if anyone can help

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Newbie Jones 1,386 Reputation points
    2022-06-24T09:55:51.13+00:00

    A quick Google search.

    https://www.tenforums.com/tutorials/23504-restore-default-location-personal-folders-windows-10-a.html

    The batch files have the registry keys you are seeking.

    How to modify the registry with PowerShell?

    https://www.get-itsolutions.com/add-registry-key-values-with-cmd-powershell-batch

    These links should get you going.

    0 comments No comments

  2. Limitless Technology 39,926 Reputation points
    2022-06-24T15:01:24.22+00:00

    Hi there,

    You can use the below script to make the registry key to its default value.

    $RegKey = "HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client" # Container object
    $RegLeaf = "(Default)" # Leaf object
    $RegValue = "Current value" # Content of leaf object

    Set-ItemProperty -Path $RegKey -Name $RegLeaf -Value $RegValue

    --------------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.