# Powershell suitable conditions for below scenario

**URL:** <https://forums.powershell.org/t/powershell-suitable-conditions-for-below-scenario/18050>\
**Category:** PowerShell Help\
**Created:** [November 26, 2021, 10:13am UTC](https://forums.powershell.org/t/powershell-suitable-conditions-for-below-scenario/18050 "2021-11-26T10:13:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vickynet](https://avatars.discourse-cdn.com/v4/letter/v/f475e1/32.png) [@vickynet](https://forums.powershell.org/u/vickynet)\
**Post date:** [November 26, 2021, 10:13am UTC](https://forums.powershell.org/t/powershell-suitable-conditions-for-below-scenario/18050/1 "2021-11-26T10:13:56Z")

</div>

Hi,

Am looking for the powershell condition to manipulate the below scenari so could you please help me on this.

We need to tag all the computers under [ABC.com/testou/computer](http://ABC.com/testou/computer) ou

“HAW” needs to be written to extensionattribute1 on computer objects.

Once the computer is moved out of this OU the tag must be removed

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [November 26, 2021, 3:07pm UTC](https://forums.powershell.org/t/powershell-suitable-conditions-for-below-scenario/18050/2 "2021-11-26T15:07:26Z")

</div>

What do you meant with “PowerShell condition”?

If you want to write a script and don’t know where to start … the following help topics should get you started:

> **[Get-ADComputer (ActiveDirectory)](https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-adcomputer?view=windowsserver2019-ps)**
>
> Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.

> **[ForEach-Object (Microsoft.PowerShell.Core) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7.2)**
>
> The ForEach-Object cmdlet performs an operation on each item in a collection of input objects. The input objects can be piped to the cmdlet or specified using the InputObject parameter. Starting in Windows PowerShell 3.0, there are two different ways...

> **[Set-ADComputer (ActiveDirectory)](https://docs.microsoft.com/en-us/powershell/module/activedirectory/set-adcomputer?view=windowsserver2019-ps)**
>
> Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:20pm UTC](https://forums.powershell.org/t/powershell-suitable-conditions-for-below-scenario/18050/3 "2024-05-16T20:20:09Z")

</div>


