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
Appcmd.exe exists at the location %systemroot%\system32\inetsrv\. You either need to udpate 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.
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".
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
I had the same issue and resolved it by doing the following:
$systemRoot = [environment]::GetEnvironmentVariable("systemroot")
Set-Location $systemRoot\system32\inetsrv
.\appcmd
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
来源:https://stackoverflow.com/questions/24945542/the-term-appcmd-is-not-recognized-as-the-name-of-a-cmdlet
