continue
I have some code to get a list of IIS6 sites through ADSI:
([adsi]"IIS://localhost/W3SVC").psbase.children | select servercomment, serverstate | Where-Object {$_.serverstate -ne $null}
servercomment serverstate
------------- -----------
{Default Web Site} {4}
{SharePoint Web Services} {4}
{SharePoint Central Administration v4} {4}
{SharePoint - 80} {4}
When I pipe it through the convertto cmdlets or out-string or looping through objects using tostring() I get something like this
#TYPE Selected.System.DirectoryServices.DirectoryEntry
"servercomment","serverstate"
"System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
"System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
"System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
"System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
Basically I just need the list of sites (servercomment) to be treated like Powershell objects so I can export them through various means. But from my understanding these are collections in themselves and do have more properties, but when I go deeper I don't see anything that can be extracted as the name of an IIS site. Is getting this info through WMI easier or do I have to create a new Powershell object to contain these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
This will give you an array of custom psobjects with those two child items as noteproperties, along with the string values.