Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Adding the results of Null before continuing

$
0
0

Hi All,

I don’t know what the best way to describe this is but ill try my best.

I have a script that will create 3 groups and I need to do some checks before I create those groups. If one of the 3 groups exist I do not want to continue.

What I want to do is if the nul value equals 1 or more to stop and then I can write out the results. I am not sure how to complete the last couple of lines.

What I have is below –

$GPexists = $null try{ $GroupExists = Get-ADGroup -Identity $GroupNameRW -ErrorVariable GPexists1 $GroupExists = Get-ADGroup -Identity $GroupNameRO -ErrorVariable GPexists2 $GroupExists = Get-ADGroup -Identity $GroupNameO -ErrorVariable GPexists3 }catch{} if (!$GPexists1.count) + (GPexists2 + GPexists3 -ge1) 

submitted by /u/EnvyYou
[link] [comments]

The post Adding the results of Null before continuing appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles