To give something back. KIX works better for me and I made this script for removing Citrix pnagen.exe LNK files from a user as Receiver 4.3 does not clean up during install:
;---------------------------------------------------------------------
; Filename..: RemoveIcaLNK.kix
; Author....: Arild Skullerud inspired by enumfiles by David M. Stein
; Date......: 09/24/15
; Purpose...: Remove all LNK files with a set of folders
; Removes only LNK files pointing to:
; "C:\Program Files (x86)\Citrix\ICA Client\pnagent.exe"
; Created with the purpose of cleaning up LNK files before
; installing Citrix Receiver 4.3 as it fails cleaning up.
;---------------------------------------------------------------------
; Simple folders I could remove in a simple way
RD ("%AppData%\Microsoft\Windows\Start Menu\Programs\XenApp\") /s
RD ("%AppData%\Microsoft\Windows\Start Menu\Programs\Metaframe\") /s
;--------------------------------------------------------------------------------------------------------------
; Deletes $lnkfilepath pointing to the lnk file to be deleted
; $targetpath is the EXE the lnk points to ( or any other filetype)
;--------------------------------------------------------------------------------------------------------------
Function WshRmInvShortCut($lnkfilepath,$targetpath)
dim $shell,$shortcut
$shell = createobject("wscript.shell")
if $shell
$shortcut = $shell.createshortcut("$lnkfilepath")
if $shortcut
if $shortcut.targetpath=$targetpath
; Some debug lines
;? $shortcut.targetpath
;? $lnkfilepath
; Delete only the LNK file that points to the correct exe here
;DEL ($lnkfilepath) /h /s
$shortcut = 0
endif
endif
$shell = 0
endif
exit @error
EndFunction
;--------------------------------------------------------------------------------------------------------------
; Searches $StartPath for files ending with $ext and calls WshRmInvShortCut for removing them
; $targetpath is the exe the lnk points to
;--------------------------------------------------------------------------------------------------------------
Function Enum_Files($StartPath, $Ext)
Dim $fName
$fName = Dir("$StartPath\*.$Ext")
While $fName <> "" And @ERROR = 0
WshRmInvShortCut($StartPath+\+$fname,$targetpath)
$fName = Dir()
Loop
EndFunction
;--------------------------------------------------------------------------------------------------------------
; Script running from here
; Path to pnagent.exe
$targetpath = "C:\Program Files (x86)\Citrix\ICA Client\pnagent.exe"
; Filename ending
$Ext = "lnk"
; Path to folder I want to search and empty of lnk files
$StartPath="%appdata%\Microsoft\Windows\Start Menu\Programs"
; Calling script for first path
$=Enum_Files($StartPath, $Ext)
; Path to folder I want to search and empty of lnk files
$StartPath="%userprofile%\Desktop"
; Calling script for second path
$=Enum_Files($StartPath, $Ext)
:END