I have this script where I'm trying to set the IISIntrinsic property for components of an application in Com+ in Component Services.
This is what I'm trying to tick
Here's my powershell script:
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
# -- Shut down the running app
$comAdmin.ShutdownApplication("MyAppName")
# -- Loop through components
$applications = $comAdmin.GetCollection("Applications")
$applications.Populate()
foreach ($application in $applications)
{
if ($application.Name -eq "MyAppName")
{
$components = $applications.GetCollection("Components",$application.key)
$components.Populate()
foreach ($component in $components)
{
# -- Set property
$component.Value("IISIntrinsics") = $true
}
#-- EDIT - ADDING THIS LINE SOLVED THE ISSUE
$components.SaveChanges()
}
}
# -- Save and exit
$applications.SaveChanges()
# -- start the application again
$comAdmin.StartApplication("MyAppName")
Setting IISIntrinsics to true doesn't seem to have any impact.
My feeling is that
- Either $applications.SaveChanges() is the wrong thing to call OR
- The way I'm setting the property is incorrect (I also tried setting it to 1 without success)
Any help would be greatly appreciated!
I found the issue
The line below the comment marked #-- EDIT in the code above contains the following:
This was required to save the changes made to the components.
Also worth noting that in Component services, you need to refresh the component view in order to see your changes.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;287422 shows a vbscript implementation that should be worth looking at. It does a couple of odd things like looping in reverse - whether this is necessary or not is unknown to me. Anyway - it looks like setting the value to 1 should work.