January 14, 2016 at 9:22 am #33898
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
January 15, 2016 at 7:21 am #33943
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 |
# Get the item properties |
Where value -like 'whatever' |
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.
January 15, 2016 at 8:32 am #33953
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.
January 15, 2016 at 8:47 am #33954
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.
January 15, 2016 at 9:04 am #33955
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
January 15, 2016 at 9:10 am #33956
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.
January 15, 2016 at 9:11 am #33957
ok i will try
January 15, 2016 at 9:25 am #33958
Don that worked I'm leaving you in my will thanks man
You must be logged in to reply to this topic.