Re: VB.NET (2.0) impersonate not working



On May 17, 1:33 pm, NathanC <Nath...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have a web project that is running this code: (generalized for security)

refWMIService = GetObject("winmgmts:\\computer_name")
colcomputers = refWMIService.ExecQuery("Select * From
Win32_OperatingSystem")
For Each refComputer In colcomputers
If refComputer.reboot() = 0 Then
Response.Write("reboot")
Else
Response.Write("nope")
End If

This is WMI functionality and on the remote computer - the ASPNET account
obviously does not have permission to do this - and I can see Failed Audit
events in the computer security log. So, I have added this bit of code to the
web.config file for the project:

<identity impersonate="true" userName="subdomain.domain.com\username"
password="password" />

When I rebuild the project and even restart IIS - the call is still hitting
the remote computer as ASPNET account - although my understanding is that
because of the impersonate web.config tag - it should send using the higher
access credentials.

Any thoughts? Thanks,



I do not believe WMI security model works that way.

Just because you tell ASP.Net to impersonate a user identity to
execute WMI code, it does not mean that WMI flows the thread-
impersonated user identity across to the other machine. I believe with
WMI you have to give the username/password in code to the WMI
connection itself.

See how to do this with with the IIS6 Administration scripts like
iisback.vbs which shows how to make remote WMI calls using a specified
user credential.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

.



Relevant Pages

  • Re: Connect by WMI to a remote stand-alone computer(doesnt belong to any domain)
    ... I read that WMI needs at least 135 and 445 ports open but these ports have ... "Connecting to WMI on a Remote Computer" ... My first task is to make the connection to work. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: problem : objLocator.ConnectServer returns Access is denied
    ... Connecting to WMI on a Remote Computer ... It sounds like you are missing an access control entry in the WMI security for the user you are using. ... My computer is on a domain, while "targetcomputer" is in a workgroup. ... Dim ojLocator, objbWMI, colBIOS, clsBIOS ...
    (microsoft.public.win32.programmer.wmi)
  • Re: check remote computer name through its IP
    ... Otherwise, either the remote computer does not have WMI installed (older than Windows 2000), WMI is corrupt, or WMI is blocked by a firewall. ... Of course, this assumes the remote computer is online and you have connectivity, which should be the case if you can ping it. ...
    (microsoft.public.scripting.vbscript)
  • Re: Run command on remote computer
    ... You can e.g. use WMI for this, but to be able to access network resources ... Install Software on a Remote Computer ... couple of command line utilities you might want to try out: ... Microsoft MVP Scripting and WMI, ...
    (microsoft.public.scripting.vbscript)
  • Re: Connect by WMI to a remote stand-alone computer(doesnt belong to any domain)
    ... remote computer B by WMI. ... The remote computer B has the following properties: ... My first task is to make the connection to work. ... ports but I don't know which ports are needed for WMI. ...
    (microsoft.public.win32.programmer.wmi)