Convert Microsoft.IIs.PowerShell.Framework.* objects to PSCustom#2510
Convert Microsoft.IIs.PowerShell.Framework.* objects to PSCustom#2510dpaulson45 wants to merge 1 commit intomainfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This pull request addresses serialization issues with Microsoft IIS PowerShell Framework objects that cause "Value does not fall within the expected range" exceptions when using jobs or Export-Clixml. The fix introduces a new ConvertTo-PSObject function that manually converts these objects to PSCustomObject by walking their properties, preventing serialization failures.
Changes:
- Added new ConvertTo-PSObject.ps1 function to recursively convert IIS Framework objects to PSCustomObject
- Modified Get-IISWebSite.ps1 to convert site and binding objects before returning
- Modified Get-IISWebApplication.ps1 to convert web application objects before returning
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 14 comments.
| File | Description |
|---|---|
| ConvertTo-PSObject.ps1 | New utility function that recursively converts objects to PSCustomObject, with depth limiting and type filtering to handle serialization issues |
| Get-IISWebSite.ps1 | Updated to convert IIS site and binding objects using ConvertTo-PSObject before constructing return objects |
| Get-IISWebApplication.ps1 | Updated to convert IIS web application objects using ConvertTo-PSObject before constructing return objects |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
e315d40 to
291c3e6
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
291c3e6 to
cc9e03c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
Diagnostics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/Get-IISWebSite.ps1
Show resolved
Hide resolved
Diagnostics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/Get-IISWebSite.ps1
Show resolved
Hide resolved
...cs/HealthChecker/DataCollection/ExchangeInformation/IISInformation/Get-IISWebApplication.ps1
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
Diagnostics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/Get-IISWebSite.ps1
Show resolved
Hide resolved
...cs/HealthChecker/DataCollection/ExchangeInformation/IISInformation/Get-IISWebApplication.ps1
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
...stics/HealthChecker/DataCollection/ExchangeInformation/IISInformation/ConvertTo-PSObject.ps1
Show resolved
Hide resolved
b1d0760 to
53062b8
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
We need to this to help prevent serialization issues by having that class trying to convert it. Now it is done manually Add changes based off Copilot review
53062b8 to
47a3549
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Issue:
On some computers, we are not able to automatically convert the IIS cmdlets to a data stream resulting in an error exception
Value does not fall within the expected range.Reason:
We need to this to help prevent serialization issues by having that class trying to convert it.
Fix:
Manually walk the object attributes and convert it to a Custom PS Object to be returned. This then would allow the script to properly work.
Resolved #2505
Validation:
Lab/Pester tested. Customer verified resolved issue.