33

I'm getting the following error message:

The term 'appcmd' 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:7

Mohammad Nadeem
  • 9,134
  • 14
  • 56
  • 82
user3874995
  • 331
  • 1
  • 3
  • 3
  • What is it that you're trying to do? – Dave Cousineau Jul 24 '14 at 23:28
  • You have not provided enough information for the question to be reasonably answered. The error message is quite clear and informative, you are trying to call appcmd but it cannot be found. Since you still asking, there is something else that is not clear to you. Explain what you are trying to achieve, show your code, say what you are getting instead (you've done this last part). It is much more easier helping, when you can describe a particular problem you are dealing with rather than posting a random error message without any context. – Andrew Savinykh Jul 24 '14 at 23:32
  • I am trying to recycle apppool using appcmd, However initially i am getting this error.C:\Windows\System32\WindowsPowerShell\v1.0>appcmd 'appcmd' is not recognized as an internal or external command, operable program or batch file. C:\Windows\System32\WindowsPowerShell\v1.0>psexec appcmd 'psexec' is not recognized as an internal or external command, operable program or batch file. – user3874995 Jul 24 '14 at 23:42
  • Yep, appcmd or psexec cannot be found. It seems pretty clear. You need either to add them to your PATH or specify path to them explicitly. – Andrew Savinykh Jul 25 '14 at 00:07

7 Answers7

46

Appcmd.exe exists at the location %systemroot%\system32\inetsrv\. You either need to update your PATH variable to add the path %systemroot%\system32\inetsrv\ like

SET PATH=%PATH%;%systemroot%\system32\inetsrv\

or you can use Set-Location to first go to the location of Appcmd.exe like

Set-Location %systemroot%\system32\inetsrv\

and then run you command.

OR you can use the following:

c:\windows\system32\inetsrv\appcmd.exe

Community
  • 1
  • 1
Mohammad Nadeem
  • 9,134
  • 14
  • 56
  • 82
20

I think the user has the same problem I did: %systemroot%\system32\inetsrv\ was empty on my machine.

You need to "Turn Windows features on and off", and then select "IIS Management Scripts and Tools" under "Internet Information Services"->"Web Management Tools".

9

Open command prompt as administrator, and try....

cd c:\windows\system32\inetsrv

then type

appcmd 

see my example below enter image description here

vote up if it works for you : D

Edwin O.
  • 4,998
  • 41
  • 44
  • This is how you would test if appcmd is in place, but does not help if the tool is in place, but not configured in path – WillDud Sep 06 '17 at 11:26
  • why the downvote ? you are not correct @WillDud..the steps i provided above explicitly shows you'll need to cd into the location where executable leaves...so no talk of path configuration or not.. – Edwin O. Sep 06 '17 at 12:10
  • 1
    For me, when I run the appcmd from the path you've mentioned, it returns same error: The term 'appcmd' is not recognized as the name of a cmdlet, – Amir978 May 19 '20 at 05:36
5

The issue is not just the path of the file.

Suggestion [3,General]: The command appcmd was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type ".\appcmd". See "get-help about_Command_Precedence" for more details.

So please run as follows:

.\appcmd set config -section:system.applicationHost/sites /+"[name='Default Web Site'].bindings.[protocol='https',bindingInformation='*:443:']" /commit:apphost
Fitch
  • 51
  • 1
  • 1
  • 1
    None of the other answers worked for me, this one did. I checked that appcmd.exe existed in %systemroot%\system32\inetsrv then tried Set-Location. No dice. But running `.\appcmd` rather than `appcmd` or `appcmd.exe` worked. – Simon Elms Mar 31 '17 at 00:55
3

I had the same issue and resolved it by doing the following:

$systemRoot = [environment]::GetEnvironmentVariable("systemroot")
Set-Location $systemRoot\system32\inetsrv
.\appcmd
Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114
1

I don't like to manually play with PATH or system env. The portable solution is to use the full path and name of the command:

For example, to recycle an app pool:

%systemroot%\system32\inetsrv\appcmd.exe recycle apppool /apppool.name:"my website app pool name"
Shadi Alnamrouti
  • 11,796
  • 4
  • 56
  • 54
0

To view your current environment paths:

$Env:Path

To add the APPCMD path:

$Env:Path += ";C:\Windows\System32\inetsrv\"

This should allow you to use your APPCMD command e.g.:

Appcmd Set Config /Section:RequestFiltering /AllowHighBitCharacters:True
neptr
  • 17
  • 4