Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need direction - WMI, Registry permissions, and Install location.

Status
Not open for further replies.
Feb 11, 2005
153
US
I have to develop a script that does a few things.

1) I need to verify if a registry key exists and if it has the proper permissions.
2) If the permissions arent there I have to add them. This is a local group on the machine.
3) I have to check WMI and see if its working.
4) If not I have to reinstall WMI.

Here are the manaul steps I do.

run regedit
go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg and check the permissons for Local Service if its not there I add and give it full control.
I then go open WMI explorer and see if I can acess the local machine wmi.
If not then I run - rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf
when I run this I then get a prompt for a path to Windows files and then I have to type in the server share - \\Server\Share\WMIRepair\i386

Now I know how to do a regread and I think the run command should be simple to do with a wshell.run command.

What I don't know about is the following -
1) checking permissions and adding permissions with VBScript.
2) Also what is a simple way to see if WMI is working? The only thing I can think of is a WMI query and look for results?

The reason I know WMI is not working right is when I use WMI explorer and I click on any Win32 object it shows absolutely no data in the instances field. I did this with OperatingSystem and other major ones with no results shown.

3) Is there any way to do an install with rundll32 where I can put the path of the install files? Right now it defaults to the install directory of the OS but the media is not in that place and is on a share so I have to change it on each install.
 
Perhaps you could try reading a key you know should exist with WMI and the StdRegProv provider. If this fails, then run your WMI repair. If WMI is repaired, then you can use it to check the access of the key in question. If you need to modify it's permissions then you can use the SetSecurityDescriptor to set the permissons. I've never tried this so this is what I see other's refer to as "air code"

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top