Thank for the advice, i made another script which worked fine.

$Index = 0

dim $array [40]

do
$KeyName = ENUMKEY("HKEY_CURRENT_USER\Printers\Connections", $Index)
$array [$Index] = $KeyName
$Index = $Index + 1
? $Index


until @error <> 0

$z = 0
do
$x=left($array [$z],13)
RedirectOutput("c:\432.txt")
? $x
if $x=",,drpdrd-ka01"
Delprinterconnection ($array [$z])
endif
$z = $z +1
until $z = 40

the redirect and ? commands are there for me to check what is happening and can be removed

the array declaration of 40 must be changed but that is spending some more time on the script. the bottemline is that it works. refining the code is next.
Problem solved.
I hope that other readers got wiser by this example of registry behavior which caused my original problem

greetings Jonas