If this is an admin script used to build an INI file for the users to draw from, you could also use remote registry reads from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares. You would still need to separate the file shares from the printer shares but that would be simple enough.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.