Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
255 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 80

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 69

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
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 configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

838 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