George George

George George

  • NA
  • 778
  • 0

access denied when accessing IIS directory

Aug 28 2008 7:37 AM

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


Answers (2)