Removing the $ from the share is not going to work as $ indicates a hidden share. If the share is actually hidden then you will need the $ at the end of the share name.

The first example you posted maps the drive no matter in what group your, what your userid is or anything. It just maps the drive for everyone.
The second example checks to see if the user running the script is a member of the given group and if he/she is then the drives gets mapped.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.