Registry

This topic contains 7 replies, has 2 voices, and was last updated by

 
Participant
2 years, 9 months ago.

  • Author
    Posts
  • #33898

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 8
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 8
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 8
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    ok i will try

  • #33958

    Participant
    Points: 0
    Rank: Member

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

The topic ‘Registry’ is closed to new replies.