I implemented the NoVarsInStrings compliance changes to the CreateShare UDF and have added the UDF changes recommended by Radimus.

Here is the new code (would this need to be updated on the UDF page?)
Code:
 
;Example:
;
;$Server ="server1"
;$SharePath ="c:\test\share"
;$ShareName ="Test Share"
;CreateShare($server,$shareName,$SharePath,,)


Function CreateShare($Server, $ShareName, $SharePath, optional $Domain, optional $hidden)

if not $domain $domain =@domain endif
if not $server $server =@wksta endif
if $hidden $sharename = $sharename + '$' endif

$unc =join(split($sharepath,":"),"$")
$uncpath="\\"+$server+"\"+$unc
if not exist($uncpath)
$path=makepath($uncpath)
endif

$FService = GetObject ("WinNT://"+$Domain+"/"+$Server+"/LanmanServer,FileService")
$FileShare = $FService.Create ("FileShare", $ShareName)
$FileShare.Path = $SharePath
$FileShare.MaxUserCount = -1 ; -1 allows unlimited connections. Any other positive number
$FileShare.SetInfo
$FService = 0
$FileShare = 0
EndFunction



The hidden share feature still isn't working. Any suggestions on what I should do? Thanks.

(*Thanks Les for TEACHING me, your examples were key)
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5