I want to run the apppool recycle from a ps1 file using this:
#****** Variables
[String] $AppPoolName = $Global:Params['IIS_App_Pool_Name']
#$AppPoolName Contains the correct App Pool value from my IIS
[String] $WD=[System.Environment]::ExpandEnvironmentVariables("%WINDIR%")
[String] $appcmd = "$WD\system32\inetsrv\appcmd.exe"
&$appcmd list APPPOOL
iex $appcmd recycle apppool $AppPoolName
But i got this error:
A positional parameter cannot be found that accepts argument 'recycle'.
非常接近,您只需要引用传递给iex
的整个字符串,否则它将尝试解析$appcmd
之后的任何内容作为参数:
iex "$appcmd recycle apppool $AppPoolName"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.