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
155 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Synchronize a new Active Directory domain with an existing Office 365 tenant
This article will help you understand what HashTables are and how to use them in PowerShell.
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…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

932 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

12 Experts available now in Live!

Get 1:1 Help Now