Kaseya Community

Internet Explorer Shortcut

  •  I would really like to figure out how to create a script/agent procedure or best way to deploy a internet shortcut to several computers.

    I have tried a batch file and a vbs script to do this, I can do this manually with both files or individual files locally.  I just can't get Kaseya to execute this.

     

    batch file

    @echo off
    cd\
    start %systemroot%\shortcut.vbs /q

     

    vbs file

    set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Company's Intranet.url")
    oUrlLink.TargetPath = "http://hbi.local/"
    oUrlLink.Save

     

    Script exported from Kaseya

     

      <?xml version="1.0" encoding="utf-8" ?>
    - <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
    - <Procedure name="Heritage Intranet Desktop Shortcut" treePres="3" id="490857536" folderId="95928313224144315192248254">
    - <Body description="Simple Script to please http://www.hbi.local on users desktop at Heritage. GC">
    - <Statement description="Write the selected file to the machine at the path specified - full path required." name="WriteFile" continueOnFail="false">
      <Parameter xsi:type="StringParameter" name="Path" value=""%systemroot%\hbilocal.bat"" />
      <Parameter xsi:type="StringParameter" name="ManagedFile" value="gconnors\hbilocal.bat" />
      <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False" />
      </Statement>
    - <Statement description="Write the selected file to the machine at the path specified - full path required." name="WriteFile" continueOnFail="false">
      <Parameter xsi:type="StringParameter" name="Path" value=""%systemroot%\shortcut.vbs"" />
      <Parameter xsi:type="StringParameter" name="ManagedFile" value="gconnors\shortcut.vbs" />
      <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False" />
      </Statement>
    - <Statement description="Execute the specified file - full path to file required." name="ExecuteFile" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
      <Parameter xsi:type="StringParameter" name="Path" value="%windir%\system32\wscript.exe" />
      <Parameter xsi:type="StringParameter" name="Arguments" value="%systemroot%\shortcut.vbs" />
      <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
      <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="False" />
      </Statement>
      </Body>
      </Procedure>
      </ScriptExport>

     

     

     

  • Could you create the .url file on one machine and use Kaseya to copy it to the all users folder on others?  I have done this on a few occasions.

  • use vb script it'll work better. You can drop the vbs into the c:\temp and run it. So say something like this:

     

    'Desktop URL's

    set WshUrlShortcut = WshShell.CreateShortcut (strDesktopPath & "\Outlook Web App.url")

    WshUrlShortcut.TargetPath = "http://mail.mycompany.com"

    WshUrlShortcut.Save

     

    set WshUrlShortcut = WshShell.CreateShortcut (strDesktopPath & "\RealPage.url")

    WshUrlShortcut.TargetPath = "http://another website.com/"

    WshUrlShortcut.Save

     

    'IE Fav's 

    set WshUrlShortcut = WshShell.CreateShortcut (strFavoritesPath &  "\Outlook Web Mail.url")

    WshUrlShortcut.TargetPath = "http://mail.mywebowa.com"

    WshUrlShortcut.Save

     

     

     

    If you need more help on constructing the VBS give me a shout and I'll (at the very least) get you started in the right direction. 

  • Here ya go, this should accept arguments and set up what you need. Use the write file and execute shell command to start it

     

    execute shell command "cscript autoLink.vbs Desktop "test.url" "http://google.com"

     

    it should run on either win 7 or xp no problem. It'll tell you if you don't have enough arg's and will let you know what's acceptable as well. Enjoy :D

    Sorry I don't use the normal code tags here, but they've never worked for me.

     

     

    <code begin> 

    'Created by Danrche for Kaseya Community

    'March 20, 2012 15:25:00

    'Please use and modify as you see fit

    'No warranty or any of that stuff

    'This vbscript is an example of short cut's in VBscript

    ' This will create either a url or lnk as you specify as the target.

    '

    On Error Resume Next

    Set oArgs = WScript.Arguments

    iCount = WScript.Arguments.Count

    sCmdLine0 = WScript.Arguments.Item(0)

    sCmdLine1 = WScript.Arguments.Item(1)

    sCmdLine2 = WScript.Arguments.Item(2)

    If iCount <> 3 Then

    WScript.Echo "The correct usage is myscript.vbs 'Folder' 'shortcut' 'target'"

    WScript.Echo " Acceptable Folder entries are :" & vbCRLF _

    & "AllUsersDesktop" & vbCRLF _ 

    & "AllUsersStartMenu" & vbCRLF _

    & "AllUsersPrograms"  & vbCRLF _

    & "AllUsersStartup" & vbCRLF _

    & "Desktop" & vbCRLF _

    & "Favorites" & vbCRLF _

    & "MyDocuments" & vbCRLF _

    & "Programs" & vbCRLF _

    & "Recent" & vbCRLF _

    & "SendTo" & vbCRLF _

    & "StartMenu" & vbCRLF _

    & "Startup" & vbCRLF _

    & "Templates"

       else 

    UrlFavFolder sCmdLine0, sCmdLine1, sCmdLine2

    End IF

     

    Sub UrlFavFolder(sFolder, sShortcut, sLink)

    Set WshShell = WScript.CreateObject("Wscript.Shell")

    sFav = WshShell.SpecialFolders(sFolder)

    Set WshUrlShortcut = WshShell.CreateShortcut (sFav & "\" & sShortcut)

    WshUrlShortcut.TargetPath = sLink

    WshUrlShortcut.Save

    End Sub

     

    <code End> 

  • I just copied the shortcut (Shortcut.url - for example) to the "VSASharedFiles" folder. Then I used a "Write File" procedure to send the file to the "C:\Users\#vMachine.LoginName#\Desktop\Shortcut.url" path. I suppose for XP you would use "C:\Documents and Settings\#vMachine.LoginName#\Desktop\Shortcut.url" Simple, quick and easy.

  • "On Error Resume Next" -- I despise that line :) :)

  • Dan

    "On Error Resume Next" -- I despise that line :) :)

    lol, everyone is a critic! :D

    I put it in there to help make it easier to set the error handling for when a user puts in the wrong number of arg's. plus I put it together pretty quickly as when I saw the post one of my co-workers said that it would be helpful to him as well. so supply meets demand :D