fix: add -IgnoreLanguageMode switch to bypass CLM check in WDAC-managed environments#1127
Open
praneeth-0000 wants to merge 4 commits intodevfrom
Open
fix: add -IgnoreLanguageMode switch to bypass CLM check in WDAC-managed environments#1127praneeth-0000 wants to merge 4 commits intodevfrom
praneeth-0000 wants to merge 4 commits intodevfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in -IgnoreLanguageMode switch to allow the assessment to run in WDAC/AppLocker environments that report ConstrainedLanguage at the session level despite the module being trusted, by downgrading the language-mode block from a hard stop to a warning.
Changes:
- Add
-IgnoreLanguageModetoConnect-ZtAssessmentandInvoke-ZtAssessmentpublic cmdlets (with comment-based help updates). - Extend
Test-ZtLanguageModeto accept-IgnoreLanguageModeand returntruewith a warning when non-Full language mode is detected.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/powershell/public/Invoke-ZtAssessment.ps1 | Adds -IgnoreLanguageMode parameter and passes it into Test-ZtLanguageMode. |
| src/powershell/public/Connect-ZtAssessment.ps1 | Adds -IgnoreLanguageMode parameter and passes it into Test-ZtLanguageMode. |
| src/powershell/private/core/Test-ZtLanguageMode.ps1 | Implements -IgnoreLanguageMode behavior (warn + proceed) when language mode isn’t FullLanguage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…itch # Conflicts: # src/powershell/public/Invoke-ZtAssessment.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
addresses issue #1097
Summary
In environments where Windows Defender Application Control (WDAC) or AppLocker is enabled, PowerShell sessions always report
ConstrainedLanguageas the session language mode, even when the module is explicitly trusted by policy and runs with full .NET capability. The module was performing a hard block on any session reporting non-Full language mode, making it impossible to run the assessment on WDAC-managed devices regardless of trust configuration.Root Cause
Test-ZtLanguageModereads$ExecutionContext.SessionState.LanguageModeand immediately exits with a terminating error if the value is notFullLanguage. The session-levelLanguageModeproperty is set at process startup by WDAC and never changes.Fix
Added an
-IgnoreLanguageModeswitch toConnect-ZtAssessmentandInvoke-ZtAssessment, passed through toTest-ZtLanguageMode. When specified:Usage
Before (blocks in WDAC environments):
After (use in WDAC-managed environments where the module is trusted):
Notes
Screenshots
Connect-ZtAssessmentwith and without-IgnoreLanguageModeswitchInvoke-ZtAssessmentwith and without-IgnoreLanguageModeswtich