Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5 powershell module usage issues

Has anyone managed to use this module with success, i'm running 32bit Windows 7, where i have opened an administrator shell using run as administrator, i have imported the WebAdministration module and then attempted to use the commands with some issues, have provided two examples here

Websites

I created a web site with the following command

new-website -name testsite -port 80 -hostheader testsite -physicalpath c:\temp

Then i attempted to get the sites details using the command get-website -name testsite but it always returns all sites, seems to ignore the -name parameter. Only way i can get the site is using a filter

get-website | ? { $_.name -eq 'testsite' } | get-member

When i use appcmd it works as expected using the following command

C:\> C:\Windows\System32\inetsrv\appcmd.exe list site testsite

AppPools

When i try to list the apppools using the following command

dir iis:\apppools

i get the following error

Get-ChildItem : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Yet when i use appcmd as follows i get all the apppools as expected without any error

C:\Windows\System32\inetsrv\appcmd.exe list apppool

Has anyone successfully managed to use the WebAdministration module ?

Thanks in advance
Pat

like image 773
pmcgrath Avatar asked Apr 20 '10 10:04

pmcgrath


1 Answers

If you are already running PowerShell as an administrator and have Windows UAC disabled and you are still seeing this error, make sure WAS (Windows Process Activation Service) is running. You can stop W3SVC but PowerShell will definitely give the same head-scratching "access denied" error if WAS is stopped.

like image 70
RobO Avatar answered Oct 06 '22 19:10

RobO