/build/static/layout/Breadcrumb_cap_w.png

Deploying Browser Specific Shortcuts to Window 7 PCs

Hi Everyone, 

I've been using KACE 1000 with no real formal training so I'm rather lost. I'm trying to use it to deploy shortcuts to window 7 PCs. I'm looking for a template script that I can use to deploy specific shortcuts (and their icons) to a specific browser (Chrome, Firefox, IE). The script must also be simple since Level 1 techs will be using them to deploy the shortcuts. I'm currently having trouble with the script (see below) as when it deploys to the PC it opens the default browser. Is there an easier way to do this? Again, looking for a simple solution, any help is greatly appreciated. 

set wshShell = WScript.CreateObject("WScript.Shell" ) 
strDesktop = wshShell.SpecialFolders("AllUsersDesktop" ) 
set oShellLink = wshShell.CreateShortcut(strDesktop & "\Shortcut.lnk" ) 
oShellLink.TargetPath = "https:\\websitestringhere.com" 
oShellLink.WindowStyle = 1 
oShellLink.IconLocation = "J:\location\of\icon\on\networkdrive\ico\shortcutIcon.ico" 
oShellLink.Description = "Icon must be browser specific" 
oShellLink.Save 

Thanks!

0 Comments   [ + ] Show comments

Answers (2)

Posted by: anonymous_9363 6 years ago
Red Belt
1

Your target path needs to be prefixed with the path to and name of the browser executable.

If you know your environment - and thus what those things are - you can simply add them in. If not, you're going to have to get into some major scripting to divine the paths and executable names.

oShellLink.TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "https:\\websitestringhere.com".

BTW, embrace coding efficiency. Specifically here, have the (let's call it) interpreter make a single call, rather than 5, to the 'oShellLink' object like this:

With oShellLink
    .TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "https:\\websitestringhere.com".
    .WindowStyle = 1 
    .IconLocation = "J:\location\of\icon\on\networkdrive\ico\shortcutIcon.ico" 
    .Description = "Icon must be browser specific" 
    .Save 
End With
Also, your code contains zero error-trapping. You should always assume that NOTHING will work and add suitable error-trapping. So:

set wshShell = WScript.CreateObject("WScript.Shell" ) 
If Not IsObject("wshShell") Then
'// Branch to your error-handler code here
End If

strDesktop = wshShell....[etc., etc.] 


Comments:
  • " You should always assume that NOTHING will work and add suitable error-trapping"

    Unfortunately you are one of the few that preach this... I usually take a lot of flak for my style of coding (always assume the worst) with the comment, FFS, it's *only* a powershell/vbs/whatever script... - Pressanykey 6 years ago
    • The thing is, when you've been doing this for a while, you build up a library of functions that you simply paste into your new scripts, so it's not like you have to build everything from scratch every time. - anonymous_9363 6 years ago
Posted by: Alex_ 6 years ago
Senior White Belt
0
Hey,
you'd need to use the .exe File of the Browser you want to use as TargetPath and attach the Link you want to open to the TargetPath.
Like for Firefox: "C:\Program Files\Mozilla Firefox\firefox.exe" http://facebook.com
This would open Firefox and Facebook inside of Firefox.    

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ