Im using the enumkey to find drives that have been manually mapped. for some reason,,, not consistantly @error is 259 when there are still subkeys left. I just rolled this into production ... aaahh. any help would be appreciated..
If @INWIN = 1
Dim $counter, $Outputfile, $Index, $KeyName, $RemotePath, $ConnectedAs, $DeleteDrive, $fsize
$OutputFile="\\kxtv2\drives$\" + @USERID + ".kix"
$Index = 0
Open(2,$OutputFile,5)
While @ERROR = 0
$KeyName = EnumKey("HKEY_CURRENT_USER\Network\", $Index)
If @ERROR = 0
$RemotePath=ReadValue("HKEY_CURRENT_USER\Network\$KeyName","RemotePath")
$ConnectedAs=ReadValue("HKEY_CURRENT_USER\Network\$KeyName","UserName")
WriteLine(2,"USE " + $KeyName + ": '" + $RemotePath + "'" + Chr(13) + Chr(10))
$DeleteDrive = DelTree("HKEY_CURRENT_USER\Network\" + $KeyName)
$Index = $Index + 1
EndIf
Loop
Close(2)
$fsize = GetFileSize($OutPutFile)
If $fsize = 0
Del $OutputFile
EndIf
EndIf
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)