Now im trying something like this, but i wont work. Im I close?

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts"

$i = 0

$printer = enumvalue($key, $i)


$server = split($printer,"\")[2]
$prtname = split($printer,"\") [3]

if $server
?"**************************************"
?"server is $server for printer $prtname"
?"**************************************"
endif
;fix the connections
if $server = "oldserver"
DELPRINTERCONNECTION("$printer")
?"removed old printer-connection"


endif