Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok heres what I'd like to be able to do.

 

Using an app built in vb6 or vb.net (not fussed) edit a number of keys found in "NTUSER.dat". Basically allow the user to choose from list of options (i.e. dissable/enable user to add printers, etc) this would build the series of key changes to be made and when submitted carry them out without asking for permision on overwriting.

 

There are two manual methods I currently know of doing it. These are to either run regedit then load the hive to HKEY_USERS make edits then unload hive (Which can be time consuming if a lot.) Alternatively write a batch file that does the same thing but with dos (quicker but does prompt you "are you sure you wanna overwrite?" all the time, so a tad anoying).

 

If anyone can shed a little light on as to how to script the:

1. load/unload hive into HKEY_USERS.

2. How to edit a key without getting the confirmation message.

 

It would be appreciated. The rest, generating the list of keys, error catching, etc, isnt a problem it's just actual registry editing bit looks to be a nightmare.

  • Administrators
Posted

If you are using VB.Net there is a set of classes for working with the registry.

 

i.e.

Dim regkey As Microsoft.Win32.RegistryKey
regkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Command Processor")
MessageBox.Show(regkey.GetValue("CompletionChar"))

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

loading hives into registry

 

That looks like it allows you to edit a key but what about loading hives? For example:

 

load c:\documents and settings\default user\ntuser.dat into HKEY_USERS

 

again all help appreciated

Posted

Ahhhhh slight problem there.

 

This is the situation. All new machines are being imaged with a standard image. This image has been designed for machines in public access areas but is also to be used in staff offices and as such is heavily locked down (registry etc).

 

When a user in a public access area logs in it creates a volitile user profile on the machine. Hence no profile and significantly no "NTUSER.dat" to load/edit.

 

However, as staff machines are a single user/behind locked doors arrangement they are setup with a static profile for the user. This profile is created manually and generally the staff user would like to have a little more freedom to do things i.e add a printer.

 

What I'd like to do is this:

Before creating the users static profile, edit the default users "NTUSER.dat" and change the values of specific keys from 1 to 0. For example:

[HKEY_USERS\temp\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoAddPrinter"=DWORD:00000001

 

Thus changing the state of the machine for all users.

 

But to edit these keys you have to first load the hive and then provide a name for it. In the example above it would be called "temp".

 

Now I can do all this manually in XP, but with anything from 15 to 30 keys to change it gets a bit monotanous. I'd found a way to automate it with dos but if theres a way to do it through VB6 or VB.net it would keep me out of the dark ages.

Posted

You could just make the staff members power users on their specific computer. That should allow them a 'bit more freedom' while still not giving them the complete and total free reign of an administrator.

 

This would save a lot of hours of coding registry entries, although you wouldn't be as 'in control' of their rights. Just a suggestion!

  • Administrators
Posted

Could you not just use the Local Security policy tool / Security Templates tool from XP to create a template and then just import that into the required Computers?

 

The local security policy should be under your administrative tools, the security templates tool is an MMC snap-in.

 

If you need to automate it the command line tool secedit.exe may be useful.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...