Solved

Windows Server 2008 R2 - powershell: term 'Get-WebConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program

Posted on 2016-07-29
3
113 Views
Last Modified: 2016-08-01
I am trying to automate some IIS tasks, and the commands I need to use are not working:

Get-WebConfiguration $pathToSite | select *
set-WebConfigurationproperty $pathToValues -name username -value $taregtUser
set-WebConfigurationproperty $pathToValues -name password -value $taregtPWD

Open in new window


However when I run the Get-Module -ListAvailable, the WebAdministration show up
PS C:\Program Files\IIS> Get-Module -ListAvailable

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   ActiveDirectory           {}
Manifest   ADRMS                     {}
Manifest   AppLocker                 {}
Manifest   BestPractices             {}
Manifest   BitsTransfer              {}
Manifest   PSDiagnostics             {}
Manifest   ServerManager             {}
Manifest   TroubleshootingPack       {}
Manifest   WebAdministration         {}

Open in new window


Even the basic command:
Get-WebConfiguration

Open in new window

returns an error:
The term 'Get-WebConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:21
+ Get-WebConfiguration <<<<
    + CategoryInfo          : ObjectNotFound: (Get-WebConfiguration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Open in new window


Please help me figure out what I need to do to get this working. I am using powershell as the local administrator.
0
Comment
Question by:sqlagent007
3 Comments
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 450 total points
ID: 41735402
# first you have to import the module
import-module  WebAdministration    
# then you can use the cmdlets in the module.
Get-WebConfiguration $pathToSite | select *
set-WebConfigurationproperty $pathToValues -name username -value $taregtUser
set-WebConfigurationproperty $pathToValues -name password -value $taregtPWD

Open in new window

newer versions of powershell will load the module automatically, older versions you must explicitly  load the module
0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 50 total points
ID: 41735725
To be precise, this has changed with PowerShell 3. You can go up to PS 5 (the current one) on W2008r2, and I recommend to do so (see https://www.microsoft.com/en-us/download/details.aspx?id=50395 for download).
1
 
LVL 1

Author Closing Comment

by:sqlagent007
ID: 41737476
Thanks Experts!!
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now