Is there a way to search for all instances of configured web sites using this syntax? Is there a wild card I can use in the Site.Name query? Dim webAdmin As Object Set webAdmin = GetObject("winmgmts:root\WebAdministration") 'get instance of default web site
in IIS7 Dim site As Object 'query wmi provider for info on default web site Set site = webAdmin.Get("Site.Name='default web site'") -- is there a wild card here to return more than one site?
I'm not sure if there is a wildcard you can use, but you can create an array of sites. Consider the following code snippet.
Set webAdmin = GetObject("winmgmts:root\WebAdministration")
Set Sites = webAdmin.InstancesOf("Site")
For Each Site In Sites
WScript.Echo Site.Name & " (" & Site.Id & ")"
Next
monoliths
29 Posts
IIS7 & WMI WebAdministration question when searching sites
May 07, 2012 06:37 PM|LINK
JamieFurr
539 Posts
Re: IIS7 & WMI WebAdministration question when searching sites
Jul 07, 2012 12:01 AM|LINK
Hi monoliths,
I'm not sure if there is a wildcard you can use, but you can create an array of sites. Consider the following code snippet.
Set webAdmin = GetObject("winmgmts:root\WebAdministration")
Set Sites = webAdmin.InstancesOf("Site")
For Each Site In Sites
WScript.Echo Site.Name & " (" & Site.Id & ")"
Next
MCSA, Network +, A+
Please 'Mark as Answer' if this post helps you.
OrcsWeb: Managed Windows Hosting Solutions
"Remarkable Service. Remarkable Support."