Hey guys, I'm trying to figure a way to check if an AD group already exist after inputting into a variable.
I think I know the problem is , I just don't know to fix it. I think the While loop doesn't know how to check if $MatchingGroup is true or false and thus keep going into a loop.
Any suggestions?
i'm not the best at scripting so don't be to hard on me :)
Powershell
do{$Group=read-host"Enter Group name, DLG_"$Group1="DLG_"+$groupif($MatchingGroup=Get-ADGroup-filter{name-eq$Group1}){"$group1 already exist"}else{"group doesn't exist creating now"}}while($MatchingGroup-eq$true)