break on
use G: /DELETE
use J: /DELETE
use K: /DELETE
use L: /DELETE
use N: /DELETE
use O: /DELETE
use P: /DELETE
use Q: /DELETE
use R: /DELETE
use V: /DELETE
use W: /DELETE
use X: /DELETE
use Y: /DELETE
use Z: /DELETE
GLOBAL $CL
GLOBAL $Credentials
for each $Arg in GetCommandLine(1)
$Ct = $Ct + 1
if $Ct = 4 $Dm = $Arg endif
if $Ct = 5 $UN = $Arg endif
if $Ct = 6 $PW = $Arg endif
next
$Credentials = $DM + "\" + $UN
use H: /DELETE
use H: "\\hospfilesrv\Home\$UN" /user:$Credentials /password:$PW
use I: /DELETE
use I: "\\hospfilesrv\ss2\ed\ercommon" /user:$Credentials /password:$PW
$user=getuserdn($Credentials)
/*
if $user
$objUser=getobject("LDAP://" + $user)
$Groups = $objUser.GetEx("memberof")
for each $group in $groups
$Groupname=GetObject("LDAP://" + $Group).cn
if $groupname="edmgt"
use H: /DELETE
use H: "\\hospfilesrv\edmgt" /user:$Credentials /password:$PW
endif
if $groupname="Local Machine Admin"
use Y: /DELETE
use Y: "\\mctech02repo\backup" /user:$Credentials /password:$PW
use Z: /DELETE
use Z: "\\mctech\software" /user:$Credentials /password:$PW
endif
next
endif
*/
for each $groupname in GetADUserGroups($Credentials)
if $groupname="edmgt"
use H: /DELETE
use H: "\\hospfilesrv\edmgt" /user:$Credentials /password:$PW
endif
if $groupname="Local Machine Admin"
use Y: /DELETE
use Y: "\\mctech02repo\backup" /user:$Credentials /password:$PW
use Z: /DELETE
use Z: "\\mctech\software" /user:$Credentials /password:$PW
endif
next
Function getUserDN(optional $username)
Dim $objTrans
if $username=""
$username=@ldomain + "\"+ @userid
endif
if not instr($username,"\")
$username=@ldomain + "\" + $username
endif
$objTrans = CreateObject("NameTranslate")
if @error
exit @error
else
$objTrans.Init(3, "")
$objTrans.Set(3,$username)
$getUserDN = $objTrans.Get(1)
if @error
exit @error
endif
endif
EndFunction
function getADUserGroups(optional $username, optional $mode)
Dim $objTrans, $objUser, $group, $array[0], $i
if $username=""
$username=@ldomain + "\"+ @userid
endif
if not instr($username,"\")
$username=@ldomain + "\" + $username
endif
$objTrans = CreateObject("NameTranslate")
if @error
exit @error
else
$objTrans.Init(3, "")
$objTrans.Set(3,$username)
$username = $objTrans.Get(1)
if @error
exit @error
else
for each $group in getobject("LDAP://" + $username).GetEx("memberof")
redim preserve $array[$i]
if $mode=0
$array[$i]=GetObject("LDAP://" + $Group).cn
else
$array[$i]=$group
endif
$i=$i+1
next
$getADUserGroups=$array
endif
endif
endfunction