Results 1 to 5 of 5

Thread: [RESOLVED] [2008] WMI Access Denied

  1. #1

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Resolved [RESOLVED] [2008] WMI Access Denied

    I am trying to write some code to read the application pools from a remote machine and then eventually I will want to recycle one of the pools. I am trying to use the following code to retrieve the application pools, however I am getting an Access Denied error on the For Each line. There is no inner exception, so that is all I have to work with.

    Code:
    Dim connection As New ConnectionOptions
            connection.Username = "administrator"
            connection.Password = "password"
            
            Dim scope As New ManagementScope( _
                "\\SOMEMACHINE\root\MicrosoftIISv2", connection)
            scope.Connect()
    
            Dim query As New ObjectQuery( _
                "SELECT * FROM IIsApplicationPool")
    
            Dim searcher As New ManagementObjectSearcher(scope, query)
    
            For Each queryObj As ManagementObject In searcher.Get()
    
    
                MessageBox.Show(String.Format("Name: {0}", queryObj("Name")))
            Next
    The account I am trying with right now is the box administrator account.
    The machine is not part of a domain and it is windows 2003 server with the firewall off.
    I know the username and password are correct, because if they are not I get an error on the Scope.Connect() line.

    I have tried the suggestion at the bottom of this page, but it did not help:
    http://www.eggheadcafe.com/articles/20010614a.asp

    I even rebooted after that change, just to be sure, but still no luck.

    Any one have any other ideas? I know it is probably some silly security setting, I just don't know where else to look.

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2008] WMI Access Denied

    Negative0,

    Does this help?, its similar to your issue http://support.microsoft.com/default...b;en-us;875605

  3. #3
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2008] WMI Access Denied

    This also seems to appear as a potential fix on a few MSDN pages;

    Connection.Impersonation = ImpersonationLevel.Impersonate
    Connection.EnablePrivileges = True

  4. #4

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] WMI Access Denied

    Thanks for responding BullDog. With regards to your posts:

    I don't have the firewall enabled on either machine. I tried playing with some of the DCOM settings, but I am running as a box admin on my local machine and I have box admin rights on the remote machine with the account I specified. After making the DCOM changes on my local (and remote) machines, I still got nothing.

    I tried the Impersonation and EnablePrivilegs lines as well, but I am still getting access denied.

  5. #5

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] WMI Access Denied

    Got it! After reading this article, I needed to set the Authentication Level:

    Code:
    connection.Authentication = AuthenticationLevel.PacketPrivacy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width