well taking just this portion my guess is that it returns an error if anything

$rc = InContainer ("OU=@WKSTA,OU=kaelder,ou=lokaler-fr,DC=sosva,DC=elev","Computer")

Doubt that is the correct AD path to your computers.

Then, once the correct path is used, you need to place the code you want to run within the SELECT statements.

Using IF statements needs to be done logically as well.

Lets try some very basic small script first to make sure we can get back the expected data, then move on to having it do something based on that.

Try the Translatename UDF located here
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=82426

That should help you to get the correct path.