; MCGroups.KIX
break on
GLOBAL $CL
GLOBAL $Credentials
;Make sure no drives are carried over from previous desktop user!
use * /DELETE
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
;Thanks to Allen from the KiXtart.org forums for
;this code and the function! He did all the REAL work.
$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="MIG User Group"
use R: /DELETE
use R: "\\server\volume" /user:$Credentials /password:$PW
endif
if $groupname="Local Machine Admin"
use Z: /DELETE
use Z: "\\server\volume" /user:$Credentials /password:$PW
endif
next
endif
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