is there a way to remove all subkeys, and their subkeys, and their subkeys, ... from a defined path if the name/value contains a defined word?
$Path: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider"
$Word: "Server1"
I want to remove all items under $path (include all subkeys, ...) which contains a defined $word.
But I don't get to the deepest levels of the keys
I just get on one layer down to like:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\S-1-5-21-xxx\
But I want to all, including:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\S-1-5-21-xxx\Printers\Connections
Looking forward to your help
regards, Michael
Related
Was attempting to search our directory based on an attribute whose value is a DN. However, our user RDNs are of the form CN=Surname, GivenName, which requires that the comma be quoted in the full DN. But given an attribute like manager whose value is the DN of another user, I was unable to search for all users having specific manager. I tried (manager=CN=Surname\, GivenName,CN=users,DC=mydomain,DC=com), but got a syntax error "Bad search filter". I tried various options for quoting the DN, but all either gave me a syntax error or failed to match any objects. What am I doing wrong?
(Note that if I were looking for user objects directly, I could search for simply (CN=Surname, GivenName), with no quoting required, but I was searching for users having a specific manager. The comma-containing attribute value only becomes a problem when part of a Distinguished Name.)
The problem is that quoting the comma in the Common Name is not for the benefit of the filter parser, but for the benefit of the DN parser; the attribute value passed to that by the filter has to literally contain the backslash character. Unfortunately, the backslash is also (differently) special in LDAP filters, thus the syntax errors.
The solution is simple, but it isn't as obvious as doubling the backslash; backslash in LDAP filters works like % in URIs, so you have to use a literal backslash followed by the 2-digit hexadecimal code point for a backslash:
(manager=CN=Surname\5c, Givenname,OU=org,DC=mydomain,DC=com)
It turns out there's an example of this specific use case at the very bottom of https://docs.oracle.com/cd/E19424-01/820-4811/gdxpo/index.html#6ng8i269q.
In this question the answer includes modifying the Registry with the following line:
#="Outlook64Bridge"
Does that mean that I need to add a value for the new subkey, with the Name of #, Type of REG_SZ and Data of Outlook64Bridge?
Does the # have any special meaning to the Registry? I ask this because the second part of the answer also has instructions for adding this to another (already existing?) key.
'#' is the "default" value. In RegEdit, it is the first value listed under the name "(Default)" in any key.
Essentially I need to search for a word which can end and start with different things but always contains the same content in the middle.
i.e. 345345hello356
a0a0aphello553
I need to search through the registry for this key under:
HKCU\Software\[KeyBeingLookedFor]
So essentially, get the batch file to look through every key in HKCU\Sotware and if it finds it, spit out Key found via Echo.
I am trying to use Windows API functions compatible with Windows XP and up to find the target of a junction or symbolic link. I am using CreateFile to get a handle to the reparse point, then DeviceIoControl with the FSCTL_GET_REPARSE_POINT flag to read the reparse data into a REPARSE_DATA_BUFFER. Then, I use the offsets and lengths in the buffer to extract the SubstituteName and PrintName strings.
In Windows 8, extracting the PrintName works perfectly, giving me a normal path (ie c:\filename.ext), but in XP the PrintName section of the REPARSE_DATA_BUFFER seems to always have a length of 0, leaving me with an empty string.
Using the SubsituteName seems to work in both, but I always end up with a prefix of \??\ on the beginning of the file path (ie \??\c:\filename.ext). (as a side note, fsutil reparsepoint query shows the \??\ prefix as well).
I've read through much of the documentation on MSDN, but I can't find any explanation of this prefix. If the prefix is guaranteed to begin every SubstituteName, then I can just exclude the first four characters when I copy the file path from the buffer, but I'm not sure that this is the case. I would love to know if the "\??\" prefix appears in the SubstituteName for all Microsoft reparse points and why.
The Windows kernel has a "DOS Devices namespace" \DosDevices\ which is basically where anything you can open with CreateFile resides. (QueryDosDevice is a function which gives you all the members of that namespace.)
Because it's such a commonly used path, \??\ also redirects to that namespace. So, to the kernel, the path C:\Windows is invalid -- it should really be written as something like \??\C:\Windows. That's where this notation comes from.
The \??\ prefix means the path is not parsed. It is not guaranteed on every name, so you will have to look for the prefix on a per-name basis and skip it if present.
Update: I could not find any definitive documentation explaining exactly that \??\ actually represents, but here are some links that mention the \??\ prefix in action:
http://www.flexhex.com/docs/articles/hard-links.phtml
Note that szTarget string must contain the path prefixed with the "non-parsed" prefix "\??\", and terminated with the backslash character, for example "\??\C:\Some Dir\".
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/908b3927-1ee9-4e03-9922-b4fd49fc51a6
http://mjunction.googlecode.com/svn-history/r5/trunk/MJunction/MJunction/JunctionPoint.cs
This prefix indicates to NTFS that the path is to be treated as a non-interpreted path in the virtual file system.
Private Const NonInterpretedPathPrefix As String = "\??\"
N2CMS uses standard .net enums to define options for editable drop down lists.
My drop down options need to include spaces, but of course you can't have a space in an enum item name.
I had hoped there would be some sort of attribute I could apply to define the text for the options. But I can't see anything anywhere that seems to do it.
I managed to work out how to do it in the end (by reading the N2 source). You use global resource files.
In particular, the code in EditableEnumAttribute calls HttpContext.GetGlobalResourceObject (by calling Utility.GetGlobalResourceString) for each item in the enum.
So to have enum names with spaces (and other special characters) in them, you add a global resource file that matches the name of the enum, with an entry for each enum item that needs special characters.
The first thing you need to do is add an App_GlobalResources folder to the top level of your project. This is vital, as if you use VS.NET to create resource files elsewhere they don't get created as global ones.
Next create a resource file in App_GlobalResources that matches the name of the enum. It needs to match just the short name of the enum, not the full namespace prefixed name.
Now create an entry in the resource file for each enum item, with the enum item name in the Name column and the name including the special characters in the Value column. You don't need to add an entry for every enum item, only for the ones with special characters (though it would probably make sense to add them all).