This is a long shot, but what happens if you declare your function vars local to the UDF itself, like this:

code:
function UserOU()
dim $sysinfo
dim $user
dim $name

... the rest

Does that make any difference ?

-Shawn