Skip to content

[Issue] FindFrontEndActivity fails when SamAccountName contains a period #1986

@bill-long

Description

@bill-long

Describe the issue
Something about having a period in the SamAccountName causes us to fail to replace the $SamAccountName variable with the escaped values. And we can't pre-escape it because of the parameter validation:

[PS] C:\Users\administrator.CONTOSO\Downloads>.\FindFrontEndActivity.ps1 -SamAccountName "user1.foo"

cmdlet FindFrontEndActivity.ps1 at command pipeline position 1
Supply values for the following parameters:
ServerName[0]: exch1
ServerName[1]:
The variable cannot be validated because the value System.String[] is not a valid value for the SamAccountName variable.
At C:\Users\administrator.CONTOSO\Downloads\FindFrontEndActivity.ps1:144 char:5
+     $SamAccountName = $SamAccountName | ForEach-Object { [Regex]::Esc ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [], ValidationMetadataException
    + FullyQualifiedErrorId : ValidateSetFailure

[PS] C:\Users\administrator.CONTOSO\Downloads>.\FindFrontEndActivity.ps1 -SamAccountName "user1foo"

cmdlet FindFrontEndActivity.ps1 at command pipeline position 1
Supply values for the following parameters:
ServerName[0]: exch1
ServerName[1]:
[PS] C:\Users\administrator.CONTOSO\Downloads>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions