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 (230 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 (730 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 (190 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)
0 votes
1 answer

I've got the following script as part of a larger piece where param-members is an AD Object picker list seperated by a ' ; ' currently: New-DistributionGroup -Name ... or convert that to username but I'm struggling to achieve that with multiple Users selected

asked Jan 27, 2020 by richarddewis (220 points)
2,643 questions
2,377 answers
6,310 comments
987,431 users