I have a VB script that searches all userprofiles to delete shortcuts to old programs based on target path. Our logon script was written before I got here and it is in Kix. I was wondering if someone could help rewrite my script into KIX so I don't have to call it from the kix script. I have added the vbscript.

 Code:
Dim objShell, objFSO, sonicPath, fileFolder
Dim userFolder, desktopFolder, custFolder, extension
Dim fullname, shortcut, shortTarget

paragonPath = "C:\Program Files\Paragon93\"

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set fileFolder = objFSO.GetFolder("C:\Documents and Settings")
Set subFileFolder = fileFolder.Subfolders

For Each userFolder in subFileFolder    
	If objFSO.FolderExists(userFolder & "\Desktop") Then        
		Set desktopFolder = objFSO.GetFolder(userFolder & "\Desktop")        
		Set custFolder = desktopFolder.Files        

		For Each custFile in custFolder            
			extension = objFSO.GetExtensionName(LCase(custFile.name))            
			If extension = "lnk" then                
				'Find full path of shortcut                
				fullname = objFSO.GetAbsolutePathName(custFile)                

				'Find full path of target within shortcut                
				'See http://www.devguru.com/Technologies/wsh/quickref/wshshell_CreateShortcut.html                
				'for more information on how this works.                
				Set shortcut = objShell.CreateShortcut(fullname)                
				shortTarget = shortcut.TargetPath                    

				If InStr(shortTarget, paragonPath) then                    
					Dim myFileToDelete                    
					Set myFileToDelete = objFSO.GetFile(fullname)                    
					myFileToDelete.Delete                
				End If            
			End If        
		Next    
	End If
Next


Attachments
icon.txt (177 downloads)
Description:




Edited by Mart (2010-10-19 07:12 PM)
Edit Reason: Inserted the code from the txt attachment.