Skip to content

Script breaks registry where .exe is mentioned more than once in the string #3

Description

@poshlove

Hi. Great script but glad I did some testing across our estate first!

Example:
The problem string: C:\Program Files\Conexant\Flow\Setup64.exe -U -IFlowSetup -SRM=Flow.exe,UtilStatus,4
What the script does: "C:\Program Files\Conexant\Flow\Setup64.exe -U -IFlowSetup -SRM=Flow.exe",UtilStatus,4
What the script should have done: "C:\Program Files\Conexant\Flow\Setup64.exe" -U -IFlowSetup -SRM=Flow.exe,UtilStatus,4

Hopefully it's an easy fix?

PS. a version at the top of your script would also be useful.

[EDIT]
Ok, limited testing shows that adding question marks after some of the asterisks in the two regex lines (making the command lazy) resolves this Off to do more testing.

$ValueRegEx = '(^(?!\u0022).*?\s.*?\.[Ee][Xx][Ee](?<!\u0022))(.*$)'
$ValueRegEx = '(^(?!\u0022).*?\.[Ee][Xx][Ee](?<!\u0022))(.*$)'

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions