![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Accessing array properties from WMI Hi I'm trying to use wmi to modify the script maps for an IIS6 web site. Specifically, I want to script the adding of PUT and DELETE verbs to the aspx handler. I can see that script maps exist for a particular website's IIsWebVirtualDir in the IIS metabase. But I can't figure out how to even read it from Powershell/WMI. It always comes back blank e.g. get-wmiobject IIsWebVirtualDirSetting -namespace "root\MicrosoftIISv2" | where {$_.Name -eq "W3SVC/357108404/root"} | select-object ScriptMaps if i pipe the result into get-member the scriptmaps property is defined as: ScriptMaps Property System.Management.ManagementObject#ScriptMap[] ScriptMaps {get;set;} So maybe it's something to do with the way the property is defined? Maybe I have to access it in some other way? Thanks Martin |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Accessing array properties from WMI On Nov 28, 12:09*am, Martin Bayly <Martin Ba...@xxxxxx> wrote: Quote: > Hi > I'm trying to use wmi to modify the script maps for an IIS6 web site. * > Specifically, I want to script the adding of PUT and DELETE verbs to the aspx > handler. > > I can see that script maps exist for a particular website's IIsWebVirtualDir > in the IIS metabase. > But I can't figure out how to even read it from Powershell/WMI. *It always > comes back blank > > e.g. > > get-wmiobject IIsWebVirtualDirSetting -namespace "root\MicrosoftIISv2" | > where {$_.Name -eq "W3SVC/357108404/root"} | select-object ScriptMaps > > if i pipe the result into get-member the scriptmaps property is defined as: > ScriptMaps * * * * * * * * * *Property * * > System.Management.ManagementObject#ScriptMap[] ScriptMaps {get;set;} > > So maybe it's something to do with the way the property is defined? *Maybe I > have to access it in some other way? > > Thanks > Martin come across this before when the property you want to get is a lazy property. Lazy properties aren't populated when you pull up the object, instead you have to call the Get() method on the object and then access the property. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Accessing array properties from WMI Thanks for the reply. Yep, I've seen references to lazy properties too and wondered if it could be related to that. Which object do you think I should call Get() on. I tried just calling Get() as follows but didn't seem to make any difference. ScriptMaps is still empty. $vdir = get-wmiobject IIsWebVirtualDirSetting -namespace "root\MicrosoftIISv2" | where {$_.Name -eq "W3SVC/357108404/root"} $vdir.Get() The annoying thing is, I also tried doing this in VBScript and it seems to return the ScriptMaps ok. Didn't know either VBScript or Powershell until about 3 days ago, and beginning to think I made the wrong choice in opting for Powershell. Thanks Martin "tojo2000" wrote: Quote: > On Nov 28, 12:09 am, Martin Bayly <Martin > Ba...@xxxxxx> wrote: Quote: > > Hi > > I'm trying to use wmi to modify the script maps for an IIS6 web site. > > Specifically, I want to script the adding of PUT and DELETE verbs to the aspx > > handler. > > > > I can see that script maps exist for a particular website's IIsWebVirtualDir > > in the IIS metabase. > > But I can't figure out how to even read it from Powershell/WMI. It always > > comes back blank > > > > e.g. > > > > get-wmiobject IIsWebVirtualDirSetting -namespace "root\MicrosoftIISv2" | > > where {$_.Name -eq "W3SVC/357108404/root"} | select-object ScriptMaps > > > > if i pipe the result into get-member the scriptmaps property is defined as: > > ScriptMaps Property > > System.Management.ManagementObject#ScriptMap[] ScriptMaps {get;set;} > > > > So maybe it's something to do with the way the property is defined? Maybe I > > have to access it in some other way? > > > > Thanks > > Martin > I don't have access to an IIS server where I am right now, but I've > come across this before when the property you want to get is a lazy > property. Lazy properties aren't populated when you pull up the > object, instead you have to call the Get() method on the object and > then access the property. > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| VB script - for accessing a array returned from stored procedure | VB Script | |||
| accessing control properties | .NET General | |||
| Accessing File Properties | PowerShell | |||
| Accessing Word document properties | PowerShell | |||
| wmi accessing indexed properties | PowerShell | |||