Registry

This topic contains 7 replies, has 2 voices, and was last updated by Profile photo of Mark Hammonds Mark Hammonds 10 months, 3 weeks ago.

  • Author
    Posts
  • #33898
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    I need to find all the subkeys with a specific value say C:\users\108736 then change that value to c:\users\108735

    my real issue is I have to remove folder redirection on all my users machines so I need to change all the registry values that point to remote drives to point back to local I have the script 90% complete but the are some random registry keys I need to find and change with the script

  • #33943
    Profile photo of Don Jones
    Don Jones
    Keymaster

    So you need to search the _entire registry_ to do this? That's going to be massively impractical.

    But, it isn't syntactically difficult. In pseudo-code...

    Get-ChildItem HKCU:\Whatever\Starting\Kay -Recurse |
    ForEach {
    # Get the item properties |
    Where value -like 'whatever' |
    Set-ItemProperty
    }

    That's very obviously not running code, but it's the basic logic you could start with. Get all the keys, enumerate them. For each one, key its properties. For each of those, see which ones have a value you care about, and change the value.

    Not gonna lie. Isn't going to be quick.

  • #33953
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    yup I ditched the idea. I just opted to change the main keys that impact production the other key like MSoffice History will be cleared manually. my new issue is how to reset the ACL on the files when I move them back from the cached folder to there profile.

  • #33954
    Profile photo of Don Jones
    Don Jones
    Keymaster

    I'd probably rely on Robocopy for that. If you actually let it strip the ACL from the file, it'll inherit the ACL of the destination folder. That is, I believe, its default behavior.

  • #33955
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    im using Robocopy but it is keeping the ACL am I doing it wrong

    Robocopy "C:\WINDOWS\CSC\v2.0.6\namespace\” “C:\users\” /E /COPYALL /ZB /R:0

  • #33956
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Well, you're saying /COPYALL. That includes the ACL. So, don't do that. Maybe you're after /COPY:DATOU, which omits the ACL – but I'm not sure what else you mean to copy.

  • #33957
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    ok i will try

  • #33958
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    Don that worked I'm leaving you in my will thanks man

You must be logged in to reply to this topic.