Re: Registy access via WMI in C#

From: Dr. Strangedub (strangedub@netscape.net)
Date: 01/14/03


From: strangedub@netscape.net (Dr. Strangedub)
Date: Tue, 14 Jan 2003 16:19:37 GMT


Thanks Alex -

Well, after doing a bit of searching and tinkering yesterday, I did get
OpenRemoteBaseKey to work for me. As mentioned before, our existing .asp pages
use WMI (StdRegProv), so I figured we needed to code up analogous logic in C#...
Now, OpenRemoteBaseKey doesn't appear to use WMI, so I'm not exactly sure how it
works. (I know WMI uses DCOM under the covers - so perhaps this must also rely
on DCOM?)

-Michael Rose
Unisys Corp

On Mon, 13 Jan 2003 17:21:22 -0800, "Alek Davis"
<stop_spam_alek.davis@intel.com> wrote:

>
>Why don't you simply use RegistryKey.OpenRemoteBaseKey method to open a key
>on remote machine? This sounds pretty straight-forward.
>
>-- Alek
>
>"Dr. Strangedub" <strangedub@netscape.net> wrote in message
>news:3e233198.449674677@news.rsvl.unisys.com...
>> We are in the process of converting some specialized ASP web applications
>from
>> asp (using VBScript / Javascript) to ASP.NET (using C#). One of the
>functions
>> of our applications is to update the Windows registry on a remote host
>(either
>> the host where the web exists, or another host). Today the server-side
>VBScript
>> uses WMI to access the registry via the StdRegProv class as follows:
>> ==
>> Set objRegistry = GetObject("winmgmts:root\default:StdRegProv")
>> lAccess = KEY_NOTIFY + KEY_QUERY_VALUE + KEY_SET_VALUE
>> Err.Clear ' Initialize error status
>> lRC = objRegistry.CheckAccess(HKEY_LOCAL_MACHINE, shortPath,
>lAccess,bGranted)
>> ==
>>
>> I would appreciate any help (code samples, links, other docs) in coding
>this
>> logic in C#. We picked up the string "winmgmts:root\default:StdRegProv"
>used on
>> the GetObject call from an example at the online MSDN site -- and there
>seemed
>> to be no real explanation of how this string gets us to a Namespace.
>>
>> I know we could simply use the Microsoft.Win32 Namespace if our registry
>access
>> was limited to the localhost (i.e., the web server host), but we really do
>need
>> to do remote updates as well.
>>
>> Thanks in advance for any help on this.
>>
>> -Michael G. Rose
>> Unisys Corp.
>> michael.rose@unisys.com
>>
>>
>
>



Relevant Pages

  • Re: WMI in ASP fails on 2003 (err 80041003); works fine on 2000
    ... Second - I have two production 2000 servers here that process the WMI in ASP ... > Hi Jeff, ... >> the WMI script uses delegation to reach the remote machine. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: WMI and Virtual PC
    ... Since WMI came before Virtual PC, WMI team didn't have any support for ... Virtual PC is just another computer on the network and the host PC is ... folks what they support for discovery of Virtual PC Hosts. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: .asp vs. .htm and SCARED TO DEATH BECAUSE OF NEW OPPORTUNITY
    ... Unless you have login access to the site via FP or FTP, you can not see any ASP (server-side) code, ... FrontPage Resources, WebCircle, MS KB Quick Links, etc. ... If your friend leaves the host, ...
    (microsoft.public.frontpage.client)
  • RE: Determine if Virtual PC is running
    ... I've just checked my source code and my code for PING actually derives from ... when pinging a local pc by host name, ... that IP-address will probably respond. ... We can check for SystemName via WMI hostname check for additional security. ...
    (microsoft.public.vb.general.discussion)
  • Re: No support for asp
    ... If you want to do anything like this, you'll need to move to a host ... If you know ASP, stick with that. ... > server script block grab ado on teh server or will it grab ado on teh ...
    (microsoft.public.scripting.vbscript)