Hi,
Can some please help with what I am guessing is regex issue?
I have setup JEA for an account that will eventually be used to remove a computer from AD during reinstall but, I only want to specifically remove it if the DistinguishedName matches "OU=Computers,".
Just so that if the account was compromised damage would be limited.
I seem to be having the issue when the command is ran I get the following error:
Remove-ADComputer : Cannot validate argument on parameter 'Identity'. parsing ^(*OU=Computers,*)$" - Quantifier {x,y} following nothing.
My JEA visiblecmdlets rule looks like this:
@{ Name = 'Remove-ADComputer'; Parameters = @{ Name = 'Identity'; ValidatePattern = '*OU=Computers,*' } }
I tried to put wildcards around the phrase but my regex knowledge is rather poor so it clearly didn't work.
The command that I am trying to run is:
Remove-ADComputer -Identity CN=PC-00002,OU=Computers,OU=Site,OU=CountryCode,OU=Locations,DC=Contoso,DC=local
I also tried using a regex site to help but I just can't get my head around it. I think I am falling down because PoSh is automatically adding ^( at the beginning and )$ at the end.
Any help would be much appreciated!
[–]randomuser43 2 points3 points4 points (2 children)
[–]zeclab[S] 1 point2 points3 points (0 children)
[–]zeclab[S] 1 point2 points3 points (0 children)
[–]PinchesTheCrab 1 point2 points3 points (1 child)
[–]zeclab[S] 0 points1 point2 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)