if ($getip -match 133) {$location = (Get-ADComputer $machine -Properties CanonicalName).CanonicalName; if ($location -match "Acme.org/MGH_Workstations/DL/$machine") {Write-Host "you are in the Correct OU" -ForegroundColor Green}
ELSE {$MoveOU = 'OU=DL,OU=MGH_Workstations,DCl=Acme,DC=org'; Get-ADComputer $machine | Move-ADObject -TargetPath $MoveOU}}
The above code is a snippet from a larger script. I read a file, ping each machine in the file and then find out what vlan it is on. I then check the OU it is in and move it to the correct OU if not already there.
We have a remote site that has 3 different subnets 10.10.133.x 10.10.134.x 10.10.131.x and instead of doing 3 IF Statements I'd like to do this:
if ($getip -match 133, 134, 131) but so far this does not work. I've tried a few differnet ways and each has failed. Is it possible using -match to do this?