Skip to content

Set-CIPolicySetting Capitalizes Boolean Value | Breaks WDAC Policy (ConfigCI) #21286

Closed

Description

@NathanJepson

Prerequisites

Steps to reproduce

When using the Set-CIPolicySetting cmdlet to allow COM objects in a WDAC policy, setting the "Value" parameter to $true will result in "True" (with the first letter capitalized) being set in the tag, which will break both the "Get-CIPolicy" and "ConvertFrom-CIPolicy" cmdlets. The word must be "true" with the first letter lowercase in order to not break, as is shown here.

I made sure that the problem was reproducible in both PowerShell 5 and PowerShell 7 (since the ConfigCI module is currently marked as "Untested with Compatibility Layer" for PowerShell 7).

Expected behavior

PS> Set-CIPolicySetting -FilePath "C:\Policy1.xml" -Key "AllKeys" -Provider "AllHostIds" -Value $true -ValueName EnterpriseDefinedClsId -ValueType Boolean
PS> Get-CIPolicy "C:\Policy1.xml"

Name           : PartnerTech WinIO\51e280cd9d1d84d43fab4a7be894804f24a1ca4d39f1df16fd8c60ea0a43b786 Hash Sha1
Id             : ID_DENY_WINIO_15_1_0_0
TypeId         : Deny
Root           :
FileVersionRef :
AppIDRef       :
Wellknown      : False
Ekus           :
Exceptions     :
FileAttributes :
FileException  : False
UserMode       : False
attributes     : {[Hash, CC993C45125ED6917226511978DC6675B9E8BBD6]}

Name           : HVCIScan.exe with missing resources AMD Hash Page Sha256
Id             : ID_DENY_HVCISCAN_AMD_4_1_0
TypeId         : Deny
Root           :
FileVersionRef :
AppIDRef       :
Wellknown      : False
Ekus           :
Exceptions     :
FileAttributes :
FileException  : False
UserMode       : True
attributes     : {[Hash, 283F6E8998E7A20C68FFD8715E6F130EC7648055285883686336F5711DB1C978]}

etc...

Actual behavior

PS> Set-CIPolicySetting -FilePath "C:\Policy1.xml" -Key "AllKeys" -Provider "AllHostIds" -Value $true -ValueName EnterpriseDefinedClsId -ValueType Boolean
PS> Get-CIPolicy "C:\Policy1.xml"

Get-CIPolicy : There is an error in XML document (4720, 32).
At line:1 char:1
+ Get-CIPolicy "C:\Policy1.xml"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-CIPolicy], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SecureBoot.UserConfig.GetCIPolicy

*4720 is the line number for the tag <Boolean>True</Boolean>

Error details

PS> Get-Error

OriginInfo            : localhost
Exception             :
    Type                           : System.Management.Automation.RemoteException
    SerializedRemoteException      : System.InvalidOperationException: There is an error in XML document (4720, 32). ---> System.FormatException: The string 'True' is not a valid Boolean value.
                                     at System.Xml.XmlConvert.ToBoolean(String s)
                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read34_SettingValueType(Boolean isNullable, Boolean checkType)
                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read35_Setting(Boolean isNullable, Boolean checkType)
                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read39_SiPolicy(Boolean isNullable, Boolean checkType)
                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read40_SiPolicy()
                                     --- End of inner exception stack trace ---
                                     at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                                     at Microsoft.SecureBoot.UserConfig.XmlPolicy.ValidateXmlFile(XmlTextReader textReader)
                                     at Microsoft.SecureBoot.UserConfig.Policy.ValidateXmlFile(String xmlFilePath)
                                     at Microsoft.SecureBoot.UserConfig.Policy..ctor(String xmlFilePath)
                                     at Microsoft.SecureBoot.UserConfig.GetCIPolicy.ProcessRecord()
                                     at System.Management.Automation.CommandProcessor.ProcessRecord()
    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
    ErrorRecord                    :
        Exception             :
            Type                           : System.Management.Automation.RemoteException
            SerializedRemoteException      : System.InvalidOperationException: There is an error in XML document (4720, 32). ---> System.FormatException: The string 'True' is not a valid Boolean value.
                                             at System.Xml.XmlConvert.ToBoolean(String s)
                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read34_SettingValueType(Boolean isNullable, Boolean checkType)
                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read35_Setting(Boolean isNullable, Boolean checkType)
                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read39_SiPolicy(Boolean isNullable, Boolean checkType)
                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read40_SiPolicy()
                                             --- End of inner exception stack trace ---
                                             at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                                             at Microsoft.SecureBoot.UserConfig.XmlPolicy.ValidateXmlFile(XmlTextReader textReader)
                                             at Microsoft.SecureBoot.UserConfig.Policy.ValidateXmlFile(String xmlFilePath)
                                             at Microsoft.SecureBoot.UserConfig.Policy..ctor(String xmlFilePath)
                                             at Microsoft.SecureBoot.UserConfig.GetCIPolicy.ProcessRecord()
                                             at System.Management.Automation.CommandProcessor.ProcessRecord()
            SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
            ErrorRecord                    :
                Exception             :
                    Type                           : System.Management.Automation.RemoteException
                    SerializedRemoteException      : System.InvalidOperationException: There is an error in XML document (4720, 32). ---> System.FormatException: The string 'True' is not a valid Boolean
value.
                                                     at System.Xml.XmlConvert.ToBoolean(String s)
                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read34_SettingValueType(Boolean isNullable, Boolean checkType)
                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read35_Setting(Boolean isNullable, Boolean checkType)
                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read39_SiPolicy(Boolean isNullable, Boolean checkType)
                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read40_SiPolicy()
                                                     --- End of inner exception stack trace ---
                                                     at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                                                     at Microsoft.SecureBoot.UserConfig.XmlPolicy.ValidateXmlFile(XmlTextReader textReader)
                                                     at Microsoft.SecureBoot.UserConfig.Policy.ValidateXmlFile(String xmlFilePath)
                                                     at Microsoft.SecureBoot.UserConfig.Policy..ctor(String xmlFilePath)
                                                     at Microsoft.SecureBoot.UserConfig.GetCIPolicy.ProcessRecord()
                                                     at System.Management.Automation.CommandProcessor.ProcessRecord()
                    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                    ErrorRecord                    :
                        Exception             :
                            Type                           : System.Management.Automation.RemoteException
                            SerializedRemoteException      : System.InvalidOperationException: There is an error in XML document (4720, 32). ---> System.FormatException: The string 'True' is not a valid
Boolean value.
                                                             at System.Xml.XmlConvert.ToBoolean(String s)
                                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read34_SettingValueType(Boolean isNullable, Boolean checkType)
                                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read35_Setting(Boolean isNullable, Boolean checkType)
                                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read39_SiPolicy(Boolean isNullable, Boolean checkType)
                                                             at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read40_SiPolicy()
                                                             --- End of inner exception stack trace ---
                                                             at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                                                             at Microsoft.SecureBoot.UserConfig.XmlPolicy.ValidateXmlFile(XmlTextReader textReader)
                                                             at Microsoft.SecureBoot.UserConfig.Policy.ValidateXmlFile(String xmlFilePath)
                                                             at Microsoft.SecureBoot.UserConfig.Policy..ctor(String xmlFilePath)
                                                             at Microsoft.SecureBoot.UserConfig.GetCIPolicy.ProcessRecord()
                                                             at System.Management.Automation.CommandProcessor.ProcessRecord()
                            SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                            ErrorRecord                    :
                                Exception             :
                                    Type                           : System.Management.Automation.RemoteException
                                    SerializedRemoteException      : System.InvalidOperationException: There is an error in XML document (4720, 32). ---> System.FormatException: The string 'True' is not a
valid Boolean value.
                                                                     at System.Xml.XmlConvert.ToBoolean(String s)
                                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read34_SettingValueType(Boolean isNullable, Boolean
checkType)
                                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read35_Setting(Boolean isNullable, Boolean checkType)
                                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read39_SiPolicy(Boolean isNullable, Boolean checkType)
                                                                     at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSiPolicy.Read40_SiPolicy()
                                                                     --- End of inner exception stack trace ---
                                                                     at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                                                                     at Microsoft.SecureBoot.UserConfig.XmlPolicy.ValidateXmlFile(XmlTextReader textReader)
                                                                     at Microsoft.SecureBoot.UserConfig.Policy.ValidateXmlFile(String xmlFilePath)
                                                                     at Microsoft.SecureBoot.UserConfig.Policy..ctor(String xmlFilePath)
                                                                     at Microsoft.SecureBoot.UserConfig.GetCIPolicy.ProcessRecord()
                                                                     at System.Management.Automation.CommandProcessor.ProcessRecord()
                                    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                                    ErrorRecord                    : …
                                    Message                        : There is an error in XML document (4720, 32).
                                    HResult                        : -2146233087
                                CategoryInfo          : NotSpecified: (:) [Get-CIPolicy], InvalidOperationException
                                FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SecureBoot.UserConfig.GetCIPolicy
                            Message                        : There is an error in XML document (4720, 32).
                            HResult                        : -2146233087
                        CategoryInfo          : NotSpecified: (:) [Get-CIPolicy], InvalidOperationException
                        FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SecureBoot.UserConfig.GetCIPolicy
                    Message                        : There is an error in XML document (4720, 32).
                    HResult                        : -2146233087
                CategoryInfo          : NotSpecified: (:) [Get-CIPolicy], InvalidOperationException
                FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SecureBoot.UserConfig.GetCIPolicy
            Message                        : There is an error in XML document (4720, 32).
            HResult                        : -2146233087
        CategoryInfo          : NotSpecified: (:) [Get-CIPolicy], InvalidOperationException
        FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SecureBoot.UserConfig.GetCIPolicy
    Message                        : There is an error in XML document (4720, 32).
    HResult                        : -2146233087
CategoryInfo          : NotSpecified: (:) [Get-CIPolicy], InvalidOperationException
FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SecureBoot.UserConfig.GetCIPolicy

Environment data

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


[Windows Powershell]
PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visuals

No response

Activity

  1. added
    Needs-Triage
    on Feb 29, 2024
  2. changed the title [-]Set-CIPolicySetting Doesn't Capitalize Boolean Value | Breaks WDAC Policy (ConfigCI)[/-] [+]Set-CIPolicySetting Capitalizes Boolean Value | Breaks WDAC Policy (ConfigCI)[/+] on Feb 29, 2024
  3. mklement0 commented on Feb 29, 2024

    @mklement0
    Contributor

    The ConfigCI module that Set-CIPolicySetting is a part of isn't being maintained in this repo, so the standard advice applies (taken from the now obsolete PowerShellModuleCoverage repo, emphasis added):

    NOTE To report problems with modules that ship in Windows, use the Windows Feedback Hub. For more information, see Send feedback to Microsoft with the Feedback Hub app.


    The behavior is doubly unfortunate:

    • the -Value parameter is [string]-typed, which causes the issue, but is documented as accepting $true or $false

    • if the intent is to only support $true or $false, the parameter should be [bool]-typed, which would avoid the issue altogether.

  4. NathanJepson commented on Mar 1, 2024

    @NathanJepson
    Author

    Michael Klement (@mklement0) Thank you for the feedback, I was unaware that -Value accepted string inputs. I have verified that the cmdlet works if I supply true instead of $true .

    I have gone ahead and submitted the issue on the Windows Feedback Hub per your request. (The Windows Feedback Hub isn't just a black hole disguised as a user feedback portal, right? :) )

    Regarding Windows Feedback Hub, I just assumed that I'd submit feedback under the "Apps > PowerShell" category, not general WDAC feedback -- although, the category for general WDAC feedback, Security & Privacy - Application Control (as mentioned here ) has apparently been removed from the Feedback Hub anyway...

  5. removed
    Needs-Triage
    on Mar 1, 2024
  6. mklement0 commented on Mar 1, 2024

    @mklement0
    Contributor

    The Windows Feedback Hub isn't just a black hole disguised as a user feedback portal, right? :)

    😁 I don't know the answer to that (I have no insider knowledge; I'm just a fellow PowerShell user).

    although, the category for general WDAC feedback, Security & Privacy - Application Control (as mentioned here )

    It may have just gotten renamed, and I encourage you to provide feedback on the linked documentation page to that effect.

    I assume that Microsoft Defender App and browser control is the new name, but I'm not sure.

    image

  7. NathanJepson commented on Mar 1, 2024

    @NathanJepson
    Author

    I assume that Microsoft Defender App and browser control is the new name, but I'm not sure.

    image

    Actually, funnily enough, I have submitted a WDAC issue previously under that exact category, then someone switched it to "Microsoft Defender Antivirus", which made me think that they didn't know where to put it.
    Seemed kind of weird.

    Anyway, thanks again! Michael Klement (@mklement0)

  8. NathanJepson commented on Oct 31, 2025

    @NathanJepson
    Author

    I noticed that there's not a place on the Feedback Hub anymore to submit issues that affect both PowerShell 5 and PowerShell 7.

    I realize the GitHub instructions for submitting issues says "For Windows PowerShell 5.1 issues, suggestions, or feature requests please use the Feedback Hub app".
    However, there is not even a category for PowerShell feedback on Feedback Hub anymore. There's a category for "PowerShell 7" but not for Windows PowerShell \ PowerShell 5.

    For what it's worth, for this specific issue, I was able to reproduce the issue in both PowerShell 7 (latest version) and PowerShell 5 just now, so I'm reopening this issue.
    My feedback that I submitted to the Feedback Hub over a year ago got removed without the problem being fixed. (Which is a little frustrating.)

    Thanks for your help!

  9. NathanJepson commented on Nov 5, 2025

    @NathanJepson
    Author

    Per an earlier comment, the "ConfigCI" module isn't being maintained in this repo.

    However, Microsoft should still fix the issue so that "Set-CIPolicySetting" behaves correctly when "$true" is supplied (as opposed to "true").

    And, Microsoft's documentation at here needs to be updated since Example 1 is incorrect:

    It shows:
    Set-CIPolicySetting -FilePath C:\Policies\WDAC_policy.xml -Key "{12345678-9abc-def0-1234-56789abcdef0}" -Provider WSH -Value $True -ValueName EnterpriseDefinedClsId -ValueType Boolean

    When it should be:
    Set-CIPolicySetting -FilePath C:\Policies\WDAC_policy.xml -Key "{12345678-9abc-def0-1234-56789abcdef0}" -Provider WSH -Value true -ValueName EnterpriseDefinedClsId -ValueType Boolean

    (Where it needs to be "true" instead of "$True".)

    It's crazy that I submitted this to the feedback hub in February of 2024 and the weird quirk still isn't fixed (and feedback was removed.)

  10. added a commit that references this issue on Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions