[英]Powershell - How to use result of one WMI query in another WMI query?
[英]How to use WMI on Powershell to read IIS settings?
我是wmi,powershell,IIS和英語的入門者。
通常,我在Powershell上使用get-wmiobject遵循SampleCode。
目標:WindowsServer 2012,IIS8
Powershell運行客戶端:Windows7ProSP1x64,Powershell v5,.NET 4.6.1
Get-WmiObject -Query "Select * from Win32_QuickFixEngineering" `
-Namespace root/cimv2 -ComputerName $hostname -Credential $cred
但是對於IIS,我不知道如何使用該Commandlet。
是否有任何名稱空間收集? 如何在Powershell上將IIS使用ClassName搜索?
您不必一定要使用WMI(我認為IIS沒有用,但不要在此引用我的意思)。 您可以使用webadministration
模塊:
Import-Module WebAdministration
Get-ChildItem –Path IIS:\AppPools
New-Item –Path IIS:\AppPools\MyAppPool
Get-ItemProperty IIS:\AppPools\MyAppPool | select *
Set-ItemProperty -Path IIS:\AppPools\MyAppPool -Name managedRuntimeVersion -Value 'v4.0'
Remove-WebAppPool -Name MyAppPool
或者,您可以使用模塊中的各種cmdlet來管理IIS
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.