Kaseya Community

Desktop Icon Listing

  • I have been working on a script that would pull a user's desktop icons and store them on the kserver until the user recieved a new desktop. I will post the script below. I need a way to report on the location these .lnk files are pointing to. Any ideas would be greatly appreciated.

    Script Name: Pull all lnk files
    Script Description:

    Script Name: Pull all lnk files
    Script Description:

    IF True
    Execute Shell Command
    Parameter 1 : dir/s /w *.lnk >> c:\lnk.txt
    Parameter 2 : 0
    OS Type : 0
    Get File
    Parameter 1 : c:\lnk.txt
    Parameter 2 : lnk\lnk.txt
    Parameter 3 : 0
    OS Type : 0
    Get File
    Parameter 1 : c:\"Documents and Settings\%username%.Domain\Desktop\"Work Progs"\*.lnk"
    Parameter 2 : desktop
    Parameter 3 : 0
    OS Type : 0
    Pause Script
    Parameter 1 :
    OS Type : 0
    Send Email
    Parameter 1 : mcmonagle@realtime-it.com]pmcmonagle@realtime-it.com
    Parameter 2 : Failure to pull files from %MachineName%
    Parameter 3 :
    OS Type : 0

    Legacy Forum Name: Desktop Icon Listing,
    Legacy Posted By Username: mcmonagle
  • Okay, this is going to sound totally off the wall, but how about using Offsite Replication? It sounds crazy, but if you've used Offsite Replication and can configure it, how about this:

    1. Create an Offsite Server (presumably, this can be a server in your office). In creating the server, maybe create a folder to receive the files called "C:\Desktop Shortcuts".
    2. Now, create a Local Server using the machine you want to pull the shortcut links from. In creating it, create a folder such as "C:\ShortcutsToReplicate".
    3. Obviously, you need to be able to get a successful connection from the Local Server. If you do, then...
    4. Create a script that has a command to copy all the shortcut links to this folder, like "copy *.lnk c:\ShortcutsToReplicate\*.*" You could probably use a batch file to change directory to the appropriate "\User\Desktop" folder to get just the shortcuts you need.
    5. Now, once the files are copied to the local folder, they will magically be replicated to the Offsite folder and appear in your "C:\Desktop Shortcuts" folder. From there, you can do whatever you want.
    6. Note that if you delete the contents of the Local Folder and the machine is communicating with the Offsite Server, it will also delete the contents of the Offsite Server folder!

    Like I said, off the wall, but you get the actual shortcuts this way without having to worry about zipping files up or doing get files. (I won't take full credit for this since Farzon was the one who pointed out that Offsite Replication was NOT just for BUDR.)

    YMMV, Void where prohibited by law. Smile

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: vplaza
  • Not too easy, but not too bad either. First of all, for regular shortcuts (files ending in .LNK), use cscript to run the following javascript file (save it to a text file ending in .JS):

    Example syntax: C:\>cscript shortcut.js windows.lnk >>someoutputfile.txt

    var FSO = new ActiveXObject ("Scripting.FileSystemObject");
    var WS = new ActiveXObject ("WScript.Shell");

    if (WScript.Arguments.length == 0) WScript.quit();
    var File = WScript.Arguments(0);
    if (FSO.GetExtensionName(File) == "lnk" &&
    FSO.FileExists(File) == true) {
    var LNK = WS.CreateShortcut(File);
    var msg = "Properties for Shortcut\n" + File + "\n\n" +
    "Targetpath\t == " + LNK.Targetpath +
    "\nWorkingDir\t == " + LNK.WorkingDirectory +
    "\nIcon\t\t == " + LNK.IconLocation +
    "\nWindowStyle\t == " + LNK.WindowStyle +
    "\nHotykey\t\t == " + LNK.Hotykey +
    "\nDescription\t == " + LNK.Description;


    Now obviously you would have to collect the names of the .LNK files somehow, like running a batch file that does a dir *.lnk >links.txt type of dump, then feed each filename from the text file as a variable to the cscript command.

    For URL's its a little different. Copy each .URL to a .TXT - such as copy microsoft.url microsoft.txt. Then take both the results file from the javascript above and all the URL text files you created and combine them into one big text file. Then import the final text fileinto your script log. Then you can run a report on that script.

    Granted it sounds like a lot to do, but once you create batch files to automate it, it should run pretty smooth.

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: elehman