views:

244

answers:

1

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

A: 

You need to make sure that the PowerShell window is running elevated, try right-clicking in the Start Menu and using the "Run as administrator" option to ensure it runs elevated.

CarlosAg