Skip to content

Access denied when accessing IIS directory

George George

Asked Aug 28, 2008, 3:37 AM EDT2 answers
Share
LinkedInX

Hello everyone,


When executing the following script in PowerShell (or equivalent C# code, I post PS code for simplification purpose), there is always access denied error. My purpose is to retrieve default web site information from remote computer named TestMachine. When I changed TestMachine to  my local machine name, it is fine. Does anyone have any ideas? I am already belonging to the administrator group of the remote machine.


$siteName = (Get-Wmiobject -computer "TestMachine" -namespace "root/MicrosoftIISv2" -q "SELECT * FROM IIsWebServerSetting WHERE ServerComment = "Default Web Site").Name


regards,
George

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    hi George, i'm guessing here, but try changing the permissions on the IIS directory (wwwroot?) by clicking security and adding aspnet(full) and network services (list).

    I find that most of our 'access denied' issues are caused by this.

    cheers

    0
  • 0

    Thanks Jerry,

     

    Good point to hint me the solution. Just want to clarify that, "adding aspnet(full) and network services (list)" -- you mean add user named "aspnet" and "network service" to be able to access the directory? What do you mean full and list here?

     

    regards,

    George

    0