-
Notifications
You must be signed in to change notification settings - Fork 138
fix: add -IgnoreLanguageMode switch to bypass CLM check in WDAC-managed environments #1127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 2 commits
2d0221f
e174f95
c5ecf90
78af4fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,12 @@ Tests that exceed this limit are recorded as timed out and execution continues w | |
| For Data pillar tests and other external-module/remoting-heavy operations, timeout is a | ||
| best-effort interruption rather than a guaranteed hard stop of the underlying operation. | ||
|
|
||
| .PARAMETER IgnoreLanguageMode | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not added to ConfigurationFile configurable parameters
|
||
| When specified, bypasses the Constrained Language Mode safety check and allows the assessment to | ||
| proceed even when PowerShell reports a non-Full language mode (e.g. in WDAC-managed environments | ||
| where the module's signing certificate is trusted by policy). | ||
| WARNING: Some tests may fail or return incomplete results if CLM restrictions are truly in effect. | ||
|
|
||
| .EXAMPLE | ||
| Invoke-ZtAssessment | ||
|
|
||
|
|
@@ -181,7 +187,13 @@ function Invoke-ZtAssessment { | |
| # If specified, suppresses automatic browser opening for both the progress dashboard and the final HTML report. | ||
| [Parameter(ParameterSetName = 'Default')] | ||
| [switch] | ||
| $NoBrowser | ||
| $NoBrowser, | ||
|
|
||
| # When specified, bypasses the Constrained Language Mode check. Use only in WDAC-managed environments | ||
| # where the session reports CLM but the module is trusted and runs with full capability. | ||
| [Parameter(ParameterSetName = 'Default')] | ||
| [switch] | ||
| $IgnoreLanguageMode | ||
| ) | ||
|
|
||
| if ($script:ConnectedService -and $script:ConnectedService.Count -le 0) { | ||
|
|
@@ -237,7 +249,7 @@ $titleLine | |
| #region Preparation | ||
| Show-ZtiBanner | ||
|
|
||
| if (-not (Test-ZtLanguageMode)) { | ||
| if (-not (Test-ZtLanguageMode -IgnoreLanguageMode:$IgnoreLanguageMode)) { | ||
| Stop-PSFFunction -Message "PowerShell is running in Constrained Language Mode, which is not supported." -EnableException $true -Cmdlet $PSCmdlet | ||
praneeth-0000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user runs commands separately:
Invoke-ZtAssessmentskips auto-connect (services already connected) but still callsTest-ZtLanguageModewithout-IgnoreLanguageMode. The user acknowledged CLM risk during connect but must redundantly pass the switch again.Suggestion: Persist the decision in a script-scope variable: