Reputation: 1769
I'm trying to get all websites from my IIS service, but I need to do it through wmic.
In Powershell, I can do a get-website
and the results are in the format below, that is good enough for my needs, but I can't convet it in a wmic command.
Name ID State Physical Path Bindings
---- -- ----- ------------- --------
Default Web Site 1 Stopped %SystemDrive%\inetpub\wwwroot http *:80:
my.site 2 Started C:\Users\My/Path https 127.0.0.0:443: sslFlags=0
I searched for some options, but anything helped me. Below is my last tries:
wmic service where name = 'W3svc' call get-website
get - Invalid alias verb.
wmic PATH Win32_ServerFeatrure
2 Web Server (IIS) 0
I can get the service, but I can't call any command.
get-wmiobject -query "select * from Win32_Service where name='W3svc'"
Same problem of second option, I can get the service, but can't get any other info.
Backgroud:
I'm using a Linux client for wmic and I need to connect in Windows Server machines to get info about all websites (active or not) configured in the web server.
Are there any way to achieve it using any wmic command or WQL query?
Upvotes: 0
Views: 2659
Reputation: 357
Original question says powershell isn't an option, but one of the attempts uses get-wmiobject.
So for the sake of others trying to find this, here are some possibilities:
import-module WebAdministration
get-childitem IIS:\Sites\
this also works for finding application pools:
get-childitem IIS:\AppPools\
And then there are numerous properties and methods available through that location, than by finding the same object with:
get-wmiobject -namespace "root\WebAdministration" -class "Application"
Hope this can help anyone else.
Upvotes: 2