Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Get-adGroup DO while loop

$
0
0

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)



Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>