Delete registry keys
Posted on 2008-06-12
I need a little script to delete some registry keys on a terminal server that I'm administering. I basically need the same key deleting for every user, the key is in the SOFTWARE section, and I want all subkeys of the named key deleting too. I've tried to do this in .NET and I can work it on my PC but it won't work on the server, I get one of those helpful non-specific error messages - I've a separate question open for that but I'm getting tumbleweeds at the moment.
So in essence I need to iterate through the keys in HKEY_USERS and check for existence of a key under SOFTWARE, deleting it and all its subkeys if it exists.
Can anyone assist please?