0 votes

I have created a Custom action to create some "standard" sub OUs to a particular type of OU in our AD. I wanted to create a script to look in the OU you are executing against and not run again if ANY of the sub OUs exist. I want something like below but I am not sure how to get $OU to have the appropriate collection.

foreach ($child in $ou)
{
if(($child.Name -eq 'Groups') -or ($child.Name -eq 'Users') -or ($child.Name -eq 'Computer Systems'))
{$Context.ConditionIsMet = $False }
}

by (300 points)

Please log in or register to answer this question.

Related questions

0 votes
1 answer

Is there a way to have a Scheduled Task with 4 different condition? I want to create a scheduled task start every Monday and the condition see: The next Saturday of the week ... of the week is the fifth of the month then no action Thanks in advance, Simone

asked Jan 18 by Simone.Vailati (270 points)
0 votes
1 answer

Receive "Index operation failed; the array index evaluated to null. Stack trace: at <ScriptBlock>, <No file>: line 104>" and "Index operation failed; the ... $GroupName, $GroupDN." } } #foreach write-output "" Write-Output "" Stop-Transcript

asked Apr 14 by jbahou (20 points)
0 votes
1 answer

I'm in the process of creating a Web interface for requesting IT accounts. Upon submission, I want to run a Powershell script that will create an item in a Sharepoint task list.

asked May 14, 2021 by sandramnc (820 points)
0 votes
1 answer

I have an account that I am using as the "run as" account to run PowerShell scripts for several different custom commands. I would like to be able to update the ... a script that updates the credentials used to run a script in an existing custom command?

asked Oct 18, 2021 by KelseaIT (320 points)
0 votes
1 answer
2,780 questions
2,513 answers
6,578 comments
27,300 users