iis-7 – Powershell Get-WebSite名称参数被忽略
发布时间:2020-12-13 20:50:43 所属栏目:Windows 来源:网络整理
导读:我想使用PowerShell Get-Website cmdlet检索有关特定IIS 7网站的信息。不幸的是,Get-Website返回所有网站的信息,而不管我传入的-Name参数。看起来-Name参数被忽略。 例如,如果我使用: Import-Module WebAdministrationGet-Website -Name "Test Website"
我想使用PowerShell Get-Website cmdlet检索有关特定IIS 7网站的信息。不幸的是,Get-Website返回所有网站的信息,而不管我传入的-Name参数。看起来-Name参数被忽略。
例如,如果我使用: Import-Module WebAdministration Get-Website -Name "Test Website" 我将收到我机器上所有网站的信息: Name ID State Physical Path Bindings ---- -- ----- ------------- -------- Default Web Site 1 Started %SystemDrive%inetpubwwwroot http *:80: net.tcp 808:* net.pipe * net.msmq localhost msmq.formatname localhost Test Website 2 Started C:websitestest http *:80:test.mydomain.com 根据文档Get-Website应该返回-Name参数中指定的网站的信息。我必须误解文档或误用该cmdlet,或两者兼而有之。 如何使用Get-Website来返回特定网站的信息?
根据
this forum post,这是Get-Website cmdlet中的一个错误。解决这个问题的方法是使用Get-Item。
$website = "Test" Get-Item "IIS:sites$website" 确保使用双引号,当使用单引号时,变量不会扩展。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows-server-2008 – Server 2008远程应用程序
- 3dmax2012卸载/安装失败/如何彻底卸载清除干净3dmax2012注册
- 使用Windows等设备名称作为Java类名称
- 恢复Windows 10自带的微软正黑字体
- Windows_Win7宽带连接提示Remote Access Connection Manage
- windows-server-2008 – 如何在WIndows Server 2008 R2上设
- windows – 使用git客户端和SVN存储库的最佳工具/方法
- Windows – 命令提示符下的基本文本编辑器?
- windows – 在UWP应用程序中打开UWP
- Windows安全(在Windows 7中)一直在询问我的凭据,并且不会“
推荐文章
站长推荐
- windows-server-2008 – 管理组织中的笔记本电脑
- 使用Microsoft Exchange Server 2013阻止某些附件
- 如何防止Windows Server 2003修剪进程的工作集?
- Windows-8 – 可以在Windows 10/Windows 8/WinRT
- 在域用户帐户下运行Windows服务
- windows-mobile – 无法创建SmartDevice CAB项目
- ms-access – 当更新Microsoft Access数据库中的
- CMake安装不是在Windows上安装库
- windows – 备份服务应运行哪个用户?
- 如何在Windows 7上使用GitBash中的CLI在其默认程
热点阅读