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 (250 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 (790 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

Good afternoon, I'm looking to generate a script to allow automation of updating job titles using a spreadsheet. To do this we would use a spreadsheet generated by ... in calling the file. Please let me know if you require any additional information Regards

asked Nov 16, 2020 by jtop (680 points)
2,740 questions
2,474 answers
6,475 comments
1,373,534 users