2
Reply

access denied when accessing IIS directory

George George

George George

Aug 28 2008 7:37 AM
3.3k

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)