Was a bit frustrated at work this morning.. So, corraled myself in and re-wrote the script. Thanks Jens for the ARRAYENUMKEY as it works like a champ!

Here goes:
Code:

CLS
BREAK ON
DIM $rc
$rc=SetOption('Explicit','On')
$rc=SetOption('NoVarsInStrings','On')
DIM $admin,$printer,$printers,$pdrivers,$driverdir,$driver,$drivers,$fl,$cfg,$df,$hf,$ps,$key,$nprt,$
$admin=InGroup(@wksta+'\'+SIDtoName('S-1-5-32-544'))-1+@inwin
IF $admin=0
'Sorry, you must be an Admin on the machine you are running this on'?
'Exiting the script'?
SLEEP 2
ELSE
'Please note: You will need to re-configure RightFAX'?
'To get the printing re-enabled again'?
'---'?
SLEEP 2
'Ending the Citrix Session - if found'?
ENDPROC('WFCRUN32.EXE')
'Capturing the network printers'?
PRINTCAPTURE(1)
; -- STOP THE PRINT SPOOLER
'Stopping the Print Spooler'?
SHELL '%COMSPEC% /C NET STOP SPOOLER'

;--DELETE LOCAL USER Printers
'Deleting the local user printers'?
$printers=arrayenumkey('HKCU\Printers\Connections')
FOR EACH $printer IN $printers
$printer?
$rc=DelTree("HKCU\Printers\Connections\"+$printer)
NEXT

; -- Look for Drivers
'Looking for Drivers'?
$pdrivers='HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3'
$driverdir='%windir%\system32\spool\drivers\w32x86\3\'

$drivers=arrayenumkey($pdrivers)
FOR EACH $driver IN $drivers
IF NOT InStr($driver,'Adobe')
'Removing Print driver '+$driver?
FOR EACH $fl IN Split(ReadValue($pdrivers+'\'+$driver,'Dependent Files'),'|')
IF $fl<>''
; -- CHECK TO INSURE THE FILE EXISTS
'Checking for file: '+$fl?
IF Exist($driverdir+$fl)
'Setting Attributes on file: '+$fl?
; -- TURN ANY READ ONLY OFF
$rc=SetFileAttr($driverdir+$fl, 128)
; -- DELETE FILE
'Deleting file: '+$fl?
DEL $driverdir+$fl
ENDIF
ENDIF
NEXT
$cfg=ReadValue($pdrivers+'\'+$driver,'Configuration File')
; -- CHECK TO INSURE THE FILE EXISTS
'Checking for file: '+$cfg?
IF Exist($driverdir+$cfg)
'Setting Attributes on file: '+$cfg?
$rc=SetFileAttr($driverdir+$cfg, 128)
'Deleting file: '+$cfg?
DEL $driverdir+$cfg
ENDIF
$df=ReadValue($pdrivers+'\'+$driver,'Data File')
; -- CHECK TO INSURE THE FILE EXISTS
'Checking for file: '+$df?
IF Exist($driverdir+$df)
'Setting Attributes on file: '+$df?
$rc=SetFileAttr($driverdir+$df, 128)
'Deleting file: '+$df?
DEL $driverdir+$df
ENDIF
$hf=ReadValue($pdrivers+'\'+$driver,'Help File')
'Checking for file: '+$hf?
; -- CHECK TO INSURE THE FILE EXISTS
IF Exist($driverdir+$hf)
'Setting Attributes file: '+$hf?
$rc=SetFileAttr($driverdir+$hf, 128)
'Deleting file: '+$hf?
DEL $driverdir+$hf
ENDIF
'Deleting Registry Key for driver: '+$driver?
$rc=DelTree($pdrivers+'\'+$driver)
ENDIF
NEXT
; -- START THE PRINT SPOOLER
'Starting the Print Spooler'?
SHELL '%COMSPEC% /C NET START SPOOLER'

'Adding the Printers back in'?
IF Exist('H:')
$ps='H:\Scripts_DO_NOT_DELETE'
ELSE
$ps=Left('%WINDIR%',2)+'\Scripts'
ENDIF
IF 0=Exist($ps)
MD $ps
ENDIF
$ps=$ps+'\PRINTSETUP.ini'
FOR EACH $key IN Split(ReadProfileString($ps,'Printers',''),Chr(10))
$rc=AddPrinterConnection(ReadProfileString($ps,'Printers',$key))
NEXT
$nprt=ReadProfileString($ps,'Printers','Default')
$rc=SetDefaultPrinter($nprt)
USE LPT1: $nprt /persistent
'Process is complete'?
SLEEP 2
ENDIF

FUNCTION PRINTCAPTURE(OPTIONAL $capture)
DIM $loc,$reg,$dev,$nprt,$sysdrv,$prireg,$x,$i,$rc,$ps,$key
$loc='HKCU\Network\LPT1'
$reg='HKCU\Software\Microsoft\Windows NT\CurrentVersion'
$dev=$reg+'\Devices'
$nprt=Split(ReadValue($reg+'\Windows','Device'),',')[0]
$sysdrv=SubStr('%WINDIR%',1,2)

$loc='HKCU\Network\LPT1'
$dev=$reg+'\Devices'
$nprt=Split(ReadValue($reg+'\Windows','Device'),',')[0]
IF Exist('H:')
$ps='H:\Scripts_DO_NOT_DELETE'
ELSE
$ps=Left('%WINDIR%',2)+'\Scripts'
ENDIF
IF 0=Exist($ps)
MD $ps
ENDIF
$ps=$ps+'\PRINTSETUP.ini'

IF $capture
$i=0
DO
IF '\\'=Left($x,2)
$prireg=$prireg+$x
ENDIF
$x=EnumValue($dev,$i)
$i=$i+1
UNTIL @error
IF Len($prireg)
$rc=WriteProfileString($ps,'Printers','','')
$prireg=Split($prireg,'\\')
FOR $i=1 TO Ubound($prireg)
$rc=WriteProfileString($ps,'Printers',$i,'\\'+$prireg[$i])
NEXT
ENDIF
ENDIF
SELECT
CASE
InStr($nprt,'\\') ;WRITE THE DEFAULT PRINTER TO THE CONFIG
$rc=WriteProfileString($ps,'Printers','Default',$nprt)
USE LPT1: /delete /persistent
USE LPT1: $nprt /persistent
CASE
Exist($ps) ;NO DEFAULT PRINTER, LOAD PRINTERS FROM SAVED INFO
FOR EACH $key IN Split(ReadProfileString($ps,'Printers',''),Chr(10))
$rc=AddPrinterConnection(ReadProfileString($ps,'Printers',$key))
NEXT
$nprt=ReadProfileString($ps,'Printers','Default')
$rc=SetDefaultPrinter($nprt)
USE LPT1: $nprt /persistent
CASE
NOT InStr($nprt,'\\') ;LOCAL PRINTER DEFAULT, SO WE WANT TO REMOVE NETWORK MAPPING
USE LPT1: /delete /persistent
ENDSELECT
ENDFUNCTION

;NAME ArrayEnumKey
;ACTION Creates an array of names of the subkeys contained in a registry key or subkey
;AUTHOR Jens Meyer (sealeopard@usa.net)
;VERSION 1.2 (added error codes)
; 1.1
;DATE CREATED 2001/12/05
;DATE MODIFIED 2003/05/17
;KIXTART 4.12+
;SYNTAX ARRAYENUMKEY($subkey)
;PARAMETERS SUBKEY
; Required string containing the key or subkey for which the subkeys will be enumerated
;RETURNS Array containing the subkeys
;REMARKS none
;DEPENDENCIES none
;EXAMPLE $retcode=arrayenumkey('HKEY_USERS')
;KIXTART BBS http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000064
; Return an array of subkey names from the primary location
FUNCTION ArrayEnumKey($regsubkey)
DIM $subkeycounter, $currentsubkey, $subkeyarray
IF NOT KeyExist($regsubkey)
EXIT 87
ENDIF
$subkeycounter = 0
DO
$currentsubkey = EnumKey($regsubkey, $subkeycounter)
IF NOT @error
REDIM PRESERVE $subkeyarray[$subkeycounter]
$subkeyarray[$subkeycounter] = $currentsubkey
$subkeycounter = $subkeycounter + 1
ENDIF
UNTIL @error
$arrayenumkey = $subkeyarray
EXIT 0
ENDFUNCTION

;NAME: ENDPROC
;AUTHOR: Kent Dyer (leptonator@hotmail.com)
;CONTRIBUTORS: Conrad Wheeler "Radimus", kholm
;ACTION: Terminates a local or remote process using WMI
;SYNTAX: ENDPROC($PROC,optional $COMPUTER)
;VERSION: 1.2
;PARAMETERS: $PROC
; Required string for the name of process you want to kill
; $COMPUTER
; Optional string containing the name of the system you are interested in,
; you could use @WKSTA
;RETURNS: Returncode (0) and PID
;REMARKS: Reference - Terminate all copies of the& nbsp;Notepad process on host TEST01
; Simplified (hopefully) version of kholm's script
; No warning about program being killed.
;DEPENDENCIES: Kixtart 4.0, WMI
;EXAMPLE(s): $COMPUTER = @WKSTA
; $PROC = "NOTEPAD.EXE"
;
; ENDPROC($PROC,$COMPUTER)
;
; Returns:
; 0
; notepad.exe is 1508
FUNCTION ENDPROC($proc, OPTIONAL $computer)
DIM $process
IF $computer=''
$computer='.'
ENDIF
FOR EACH $process IN GetObject('winmgmts:{impersonationLevel=impersonate}!\\'+$computer+'\root\cimv2')
.execquery('Select * from Win32_Process where Name=' +'"'+$proc+'"')
$process.terminate
?$process.name+' is '+$process.processid
NEXT
ENDFUNCTION



Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's