Kaseya Community

Is this possible?

  • I have an issue where I have a network that users log on to many computers so there are a bunch of profiles created on each computer. I need a script that will go through all the profiles and delete certain shortcuts that were created by the users and the program is no longer used.

    Rather then uninstalling the program i would like to just delete the shortcuts.

    Legacy Forum Name: Is this possible?,
    Legacy Posted By Username: daniel5455
  • Since shortcuts are stored in in relevants paths of the User folder (or Documents and Settings), then you can simply do a recursive delete for the exact name of the shortcut (xyz.lnk) via the command prompt.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: XeviouS
  • Can you explain how to do that.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: daniel5455
  • Here is my script


    Script Name: Del Shortcuts
    Script Description:
    IF User Is Logged In
    Parameter 1 :
    THEN
    Write File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\Delshortcut.bat
    Parameter 2 : folder\Delshortcut.bat
    OS Type : 0
    Execute File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\Delshortcut.bat
    Parameter 2 :
    Parameter 3 : 1
    OS Type : 0
    Pause Script
    Parameter 1 : 600
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\delshortcut.bat
    OS Type : 0
    ELSE
    Send Email
    Parameter 1 : email@domain.com
    Parameter 2 : Delete Shortcuts failed
    Parameter 3 : Re run Script when user is logged in. #MachID#
    OS Type : 0



    The batch file works when i run it directly on the machine but if i try to run this script the files dont get deleted

    Can someone tell me where i messed up on the script. I need this to run if the user is logged off or logged in.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: daniel5455
  • daniel5455
    Here is my script


    Script Name: Del Shortcuts
    Script Description:
    IF User Is Logged In
    Parameter 1 :
    THEN
    Write File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\Delshortcut.bat
    Parameter 2 : folder\Delshortcut.bat
    OS Type : 0
    Execute File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\Delshortcut.bat
    Parameter 2 :
    Parameter 3 : 1
    OS Type : 0
    Pause Script
    Parameter 1 : 600
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\delshortcut.bat
    OS Type : 0
    ELSE
    Send Email
    Parameter 1 : email@domain.com
    Parameter 2 : Delete Shortcuts failed
    Parameter 3 : Re run Script when user is logged in. #MachID#
    OS Type : 0



    The batch file works when i run it directly on the machine but if i try to run this script the files dont get deleted

    Can someone tell me where i messed up on the script. I need this to run if the user is logged off or logged in.


    Yeah, you messed up by not attaching the batch file ;sillyface:
    Anywyas try using execute shell command.
    And you might have to impersonate user too

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty