Got it work using the EnumKey with the following code...Thanks for all the great functions guys!
code:
break on
$oldserver = "ServerName"
$array=arrayenumkey(HKEY_CURRENT_USER\Printers\Connections)
for $counter=0 to ubound($array)
$key = $array[$counter]
IF INSTR ("$key", "$oldserver")
DELKEY ("HKEY_CURRENT_USER\Printers\Connections\$key")
? 'Deleting $key'
ENDIF
next
get $
exit 0
function arrayenumkey($regsubkey)
dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray
if not keyexist($regsubkey)
$arrayenumkey=''
return
endif
$subkeycounter=0
do
$currentsubkey=enumkey($regsubkey,$subkeycounter)
if $currentsubkey<>259 and @ERROR=0
redim preserve $subkeyarray[$subkeycounter]
$subkeyarray[$subkeycounter]=$currentsubkey
$subkeycounter=$subkeycounter+1
endif
until $currentsubkey=259 or @ERROR
$arrayenumkey=$subkeyarray
endfunction