Hi,

When i try to RD an empty directory it says it is in use by another process. It's a share and first thing I do is to remove the share and then try to remove the folder.

Here are my code:
$objUser=GetObject("LDAP://cn=$username,$domain")
$DirToEmpty=$objuser.homedirectory
$uarray=SPLIT($DirToEmpty,"\")
$server=$uarray[2]
SHELL '%comspec% /c \\dkbirfs01\drift\NTReskit\RMTSHARE \\$server\$username /delete'
DELDIR($DirToEmpty)
SHELL '%comspec% /c RD $DirToEmpty /q'
$objOU = GetObject("LDAP://$domain")
? $objou.Delete("User", "cn=$username")
IF @ERROR <> 0
MESSAGEBOX("Couldn't delete $username from AD","ERROR",4112)
ENDIF

Instead of using SHELL '%comspec% /c RD $DirToEmpty /q' I've also tried the kix RD:
$objUser=GetObject("LDAP://cn=$username,$domain")
$DirToEmpty=$objuser.homedirectory
$uarray=SPLIT($DirToEmpty,"\")
$server=$uarray[2]
SHELL '%comspec% /c \\dkbirfs01\drift\NTReskit\RMTSHARE \\$server\$username /delete'
DELDIR($DirToEmpty)
? RD "$DirToEmpty"
IF @ERROR <> 0
MESSAGEBOX("Couldn't remove $DirToEmpty@CRLF@SERROR","ERROR",4112)
ENDIF
$objOU = GetObject("LDAP://$domain")
? $objou.Delete("User", "cn=$username")
IF @ERROR <> 0
MESSAGEBOX("Couldn't delete $username from AD","ERROR",4112)
ENDIF

Nobody is using the files and the folders are empty

Hope someone can help me

Jan