Skip to content

Fix PowerShell empty header validation - #130

Draft
cnotin wants to merge 1 commit into
Gerenios:masterfrom
cnotin:agent/fix-powershell-empty-header-validation
Draft

Fix PowerShell empty header validation#130
cnotin wants to merge 1 commit into
Gerenios:masterfrom
cnotin:agent/fix-powershell-empty-header-validation

Conversation

@cnotin

@cnotin cnotin commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #108.

  • Add conditional SkipHeaderValidation support for requests that intentionally use empty header values.
  • Extend the shared Invoke-WebRequest2 helper to handle empty string headers on PowerShell 6+.
  • Update direct Azure AD Connect, SharePoint, and Application Proxy REST calls.

Why

PowerShell 6+ validates empty values for standard headers such as User-Agent, causing affected AADInternals commands to fail before sending the request. Windows PowerShell 5.1 does not expose the compatibility switch.

Impact

Empty headers retain their existing on-the-wire intent under PowerShell 6+, while Windows PowerShell 5.1 remains supported through runtime parameter detection.

Validation

  • Parsed all edited scripts in PowerShell 7.6 and Windows PowerShell 5.1.
  • Verified Invoke-WebRequest2 adds SkipHeaderValidation only when supported and an empty header is present.
  • Ran git diff --check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error with PowerShell 7: "Invoke-WebRequest: The format of value '' is invalid."

1 participant