Windows 10: Using Powershell to delete REG key for all users

Discus and support Using Powershell to delete REG key for all users in Windows 10 Support to solve the problem; Hey all, not sure if this is the right place to ask, especially considering how pointed the question is. We're trying to do a thorough clean install... Discussion in 'Windows 10 Support' started by fenrir0wulf, Aug 18, 2020.

  1. Using Powershell to delete REG key for all users


    Hey all, not sure if this is the right place to ask, especially considering how pointed the question is.

    We're trying to do a thorough clean install of a software due to changing the version (specifically, we're moving from SolidWorks 2017 to 2020 SP04). However, the issue is that uninstalling everything just doesn't actually clean everything. There seems to always be something left, especially in the registry. And of course, part of the registry is exclusive to each user, meaning I just can't clean everything through the Admin account.

    So the question is this: Knowing that HKEY_USERS should contain all users that are on the computer, can I, through a Powershell script or something, delete the relevant registry keys for all users on the computer and how.

    I've managed to find a few snippets of Powershell code through Google but it's not always clear what it does or why, and most importantly what I need to adapt.

    So yeah, anyone got maybe some pointers?

    :)
     
    fenrir0wulf, Aug 18, 2020
    #1
  2. RickC Win User

    Using Powershell to delete REG key for all users

    You haven't mentioned what environment you're in so I'm going to assume Domain.

    To iterate through HKEY_USERS to do this for all users then you need all user profiles to be unloaded ('cos otherwise a logged-in user will have their NTUSER.DAT file locked for bulk editing).

    However, if all users are logged out then you'll need to log in remotely as admin... and seach/replacement of registry keys of remote users is slow - particularly with devices used by multiple users - and a pain to set up and test beforehand unless you have a test environment.

    I'm retired and no longer have an environment to test but, off the top of my head, you would be using:
    Code:
    Alternatively, use Remove-Item -Path instead of reg delete.

    I suggest a login script that makes the changes for each individual user will be easier for you to test and implement, even without a seperate test environment.

    Hope this helps...
     
    RickC, Aug 26, 2020
    #2
  3. Using Powershell to delete REG key for all users

    Hah! That is literally the piece of code I found when googling. I guess this at least confirms that it works. Fortunately, I have a computer ready for testing. I'll try that and Revo.
     
    fenrir0wulf, Aug 26, 2020
    #3
  4. Using Powershell to delete REG key for all users

    Using Powershell to delete REG key for all users

    Hey all, not sure if this is the right place to ask, especially considering how pointed the question is.

    We're trying to do a thorough clean install of a software due to changing the version (specifically, we're moving from SolidWorks 2017 to 2020 SP04). However, the issue is that uninstalling everything just doesn't actually clean everything. There seems to always be something left, especially in the registry. And of course, part of the registry is exclusive to each user, meaning I just can't clean everything through the Admin account.

    So the question is this: Knowing that HKEY_USERS should contain all users that are on the computer, can I, through a Powershell script or something, delete the relevant registry keys for all users on the computer and how.

    I've managed to find a few snippets of Powershell code through Google but it's not always clear what it does or why, and most importantly what I need to adapt.

    So yeah, anyone got maybe some pointers?
     
    fenrir0wulf, Aug 26, 2020
    #4
Thema:

Using Powershell to delete REG key for all users

Loading...
  1. Using Powershell to delete REG key for all users - Similar Threads - Using Powershell delete

  2. reg deletions need undoing?

    in Windows 10 Software and Apps
    reg deletions need undoing?: Pursuing a suggested fix for Windows 10 telling me "managed by your organization", I performed the list of register deletions suggested at https://answers.microsoft.com/en-us/windows/forum/all/managed-by-your-organisation/0999e782-6bdd-40c8-ab1c-87998c72cd46, by DaveM121. The...
  3. reg deletions need undoing?

    in Windows 10 Installation and Upgrade
    reg deletions need undoing?: Pursuing a suggested fix for Windows 10 telling me "managed by your organization", I performed the list of register deletions suggested at https://answers.microsoft.com/en-us/windows/forum/all/managed-by-your-organisation/0999e782-6bdd-40c8-ab1c-87998c72cd46, by DaveM121. The...
  4. Could not use bash command in the powershell -Reg.

    in Windows 10 Installation and Upgrade
    Could not use bash command in the powershell -Reg.: Hi, I would like to install a Perl script-based CIRCOS software for windows 10. But I could not use bash command for installation. I am getting an error when using the command "bash test.modules" Command prompt: 'bash' is not recognized as an internal or external command,...
  5. Safe to delete this reg key? ..CurrentVersion\AppModel\StateRepository

    in Windows 10 Support
    Safe to delete this reg key? ..CurrentVersion\AppModel\StateRepository: The is the full path of the registry item I was hoping someone could let me know if it's safe to delete as I'm having trouble with the Mail and Calendar app and noticed it had some items inside this. Assuming it's a cache, then I would guess that it might be okay to remove....
  6. changing key in reg

    in Windows 10 Network and Sharing
    changing key in reg: Tried to change the key in directx. Message New Key#1 entered new key following this message. Hit enter. Closed directx and the old key number was still listed. What do I need to do?...
  7. How to copy/create a reg key to every user in hkey_current_user?

    in Windows 10 Support
    How to copy/create a reg key to every user in hkey_current_user?: Hey Guys Does anyone know how I can create a reg key that only get installed once for every user in hkey_current user? I've heard I can create one in hklm and from there it can be copied to hcu ? Thanks. 132049
  8. Is deleting content in reg key "PackageList" safe?

    in Windows 10 BSOD Crashes and Debugging
    Is deleting content in reg key "PackageList" safe?: I can not open all the Windows Apps on my Windows 10 PC for some days, including the Windows Store, Photos App, etc. They open and close immediately. One solution I came across on the internet was to delete all the reg keys in this address:...
  9. How to Delete All Saved Passwords in Microsoft Edge w/ bat or reg key

    in Browsers and Email
    How to Delete All Saved Passwords in Microsoft Edge w/ bat or reg key: Does anyone know how to delete all saved passwords in Microsoft Edge either using a bat file or reg key. Looking for a way to protect users in public computer classroom. Thanks 37350
  10. How to Delete all SMBshares using Powershell?

    in Windows 10 Network and Sharing
    How to Delete all SMBshares using Powershell?: I've disabled SMB in "Turn Windows Features On or Off". How can I remove the SMBShares that return the following error when I enter remove-smbshare <Sharename>? Sample Error: remove-smbshare : The request is not supported.At line:1 char:1+ remove-smbshare <Sharename>$+...