简体   繁体   English

通过 appcmd 检查 iis 模块是否存在

[英]Check if iis module exist by appcmd

I need to check if my custom IIS module is installed for my site.我需要检查是否为我的站点安装了我的自定义 IIS 模块。 I run command bellow:我运行以下命令:

C:\windows\system32\inetsrv\appcmd.exe list config 'mySite' /section:system.webServer/modules /[name="myModuleName"]

And see the error:并查看错误:

ERROR ( message:The attribute "[name=myModuleName]" is not supported in the current command usage. )错误(消息:当前命令用法中不支持属性“[name=myModuleName]”。)

What I am doing wrong?我做错了什么?

If you are on current versions of IIS (7 and higher), then why not just use the IIS Admin or Web Admin cmdlets, vs app command for this effort?如果您使用的是当前版本的 IIS(7 及更高版本),那么为什么不直接使用 IIS Admin 或 Web Admin cmdlet、vs app 命令来完成这项工作呢?

https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-10/iisadministration-powershell-cmdlets https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-10/iisadministration-powershell-cmdlets

https://docs.microsoft.com/en-us/powershell/module/webadministration/?view=win10-ps https://docs.microsoft.com/en-us/powershell/module/webadministration/?view=win10-ps

https://octopus.com/blog/iis-powershell https://octopus.com/blog/iis-powershell

https://blogs.iis.net/jeonghwan/iis-powershell-user-guide-comparing-representative-iis-ui-tasks https://blogs.iis.net/jeonghwan/iis-powershell-user-guide-comparing-representative-iis-ui-tasks

# [IIS] Configure Module elements and properties which are configured in globalModules section 

# Case1: List all native modules
(Get-WebConfiguration //globalmodules).collection -PSPath iis:

# Case4: List all of enabled modules from 'server' level
(get-webconfiguration //modules -PSPath iis:).collection -PSPath iis:

# Case5: Get the attributes for a specific module
$modules=(get-webconfiguration //modules -PSPath iis:).collection
$modules | foreach {if ($_.name -eq "cgiModule") { $_.attributes | select name, value}}

According to your description, I suggest you could try to use below command to achieve your requirement:根据您的描述,我建议您可以尝试使用以下命令来实现您的要求:

appcmd.exe list config "{yoursitename}" -section:system.webServer/modules /text:[name='myModuleName'].type

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Powershell变量在IIS Appcmd中不起作用 - Powershell variables not working in IIS appcmd 如何将 Powershell 包裹在 IIS AppCmd 周围 - How to Wrap Powershell around IIS AppCmd 通过appcmd.exe设置IIS配置以加载用户配置文件 - Setting IIS config via appcmd.exe for Load User Profile 我可以使用PowerShell而不是AppCmd.exe来监控IIS状态吗? - Can I use PowerShell instead of AppCmd.exe to monitor IIS state? 如何在 IIS 管理器中使用 PowerShell 或 appcmd 在 Compression 中设置应用程序池磁盘空间限制? - How do I set the application pool disk space limit in IIS Manager in Compression using PowerShell or appcmd? 通过 powershell 或 appcmd 将应用程序池设置为在多个特定时间回收不会在 GUI/IIS 中同时显示 - Setting app pools to recycle at multiple specific times via powershell or appcmd does not display both times in GUI/IIS 通过 powershell 将压缩级别添加到 docker 中的 IIS 和 appcmd 失败并出现错误:格式错误的集合索引器 - Adding Compression level to IIS in docker via powershell and appcmd fails with Error: Malformed collection indexer appcmd.exe set config 不检查用户名或密码是否无效并设置它 - appcmd.exe set config doesn't check if username or password is invalid and sets it anyways 如何使用PowerShell和Web管理模块检查IIS中是否存在应用程序池? - How to check whether an application pool exists or not in IIS using powershell and web administration module? 检查IIS是否安装 - Check whether IIS is installed or not
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM