'Login Powershell Script filter to only run script if computer is in a specific OU

Using Powershell need helping with filtering If the current computer is within any of the sub OU under OU=Workstations,DC=blah,DC=com then script should continue. Else quits

What is a good code for that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source