First, you have the hack in the wrong place.

$drive="\\server\"+@userid

Second, you don't say is the shares are hidden so cannot advise on the $.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.