问题
This is a follow-up to a previous problem using a web interface for Powershell in combination with IIS commands : new-website cmdlet not working when called via web interface - that problem was fixed.
Unfortunately, when trying to add a binding to a site, the 'New-Webbinding' cmdlet fails because it cannot find the site just created via this interface (which I used to call a PS script that executes 'new-website')
error : New-WebBinding : Cannot find path 'IIS:\Sites\qlink_jan13d' because it does not exist.
However, when I do : dir iis:\sites in the PowerShell cli, the site is listed. It also shows up in IIS manager.
Also, the new-webbinding command works fine when I do it from the CLI..
Wondering if someone can get this to work via a web interface..
Check http://devinfra-us.blogspot.com/2011/02/using-powershell-20-from-aspnet-part-1.html to see how to create a web interface for Powershell
来源:https://stackoverflow.com/questions/59749805/powershell-new-webbinding-cmdlet-not-working-when-called-via-web-interface