Deploy a desktop shortcut to a URL using the K1000
I can use the KACE Desktop shortcut wizard to create a shortcut, but I don't want to link to a file location, rather I want to link to a web page. Should I just use the Scripting module?
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Using these two VB Scripts called with wscript.exe I was able to create the web link successfully. We are about to deploy this to 1000+ desktops, so it has to be flawless... ***NOTE FOR WINDOWS XP*** If you launch $KACE_SYS_DIR)\wscript.exe with params $(KACE_DEPENDENCY_DIR)\filename.vbs it will NOT work. You must use quotes around your parameters because "Documents and Settings" contains a space and your script will fail. Use: "$(KACE_DEPENDENCY_DIR)\filename.vbs" instead of $(KACE_DEPENDENCY_DIR)\filename.vbs. -------------------------------------------------------------------------------------------------------- To CREATE the link I use this script: ' Set environment variables set WshShell = WScript.CreateObject("WScript.Shell" ) strDesktop = WshShell.SpecialFolders("AllUsersDesktop" ) ' Add the WEBPAGE shortcut set oShellLink = WshShell.CreateShortcut(strDesktop & "\WEBPAGE.lnk" ) ' Set the URL oShellLink.TargetPath = "http://www.WEBPAGE.com/" ' Set window behavior oShellLink.WindowStyle = 1 ' Set icon location oShellLink.IconLocation = "%PROGRAMFILES%\internet explorer\iexplore.exe, 1" ' Set the comment field oShellLink.Description = "Access to the WEBPAGE Portal" oShellLink.Save ---------------------------------------------------------------------------------------------------------- To REMOVE the link I use this script: ' Set environment variables set WshShell = WScript.CreateObject("WScript.Shell" ) strDesktop = WshShell.SpecialFolders("AllUsersDesktop" ) ' delete this shortcut strShortcut = strDesktop & "\WEBPAGE.lnk" Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(strShortcut) Then fso.DeleteFile(strShortcut)
Using these two VB Scripts called with wscript.exe I was able to create the web link successfully. We are about to deploy this to 1000+ desktops, so it has to be flawless... ***NOTE FOR WINDOWS XP*** If you launch $KACE_SYS_DIR)\wscript.exe with params $(KACE_DEPENDENCY_DIR)\filename.vbs it will NOT work. You must use quotes around your parameters because "Documents and Settings" contains a space and your script will fail. Use: "$(KACE_DEPENDENCY_DIR)\filename.vbs" instead of $(KACE_DEPENDENCY_DIR)\filename.vbs. -------------------------------------------------------------------------------------------------------- To CREATE the link I use this script: ' Set environment variables set WshShell = WScript.CreateObject("WScript.Shell" ) strDesktop = WshShell.SpecialFolders("AllUsersDesktop" ) ' Add the WEBPAGE shortcut set oShellLink = WshShell.CreateShortcut(strDesktop & "\WEBPAGE.lnk" ) ' Set the URL oShellLink.TargetPath = "http://www.WEBPAGE.com/" ' Set window behavior oShellLink.WindowStyle = 1 ' Set icon location oShellLink.IconLocation = "%PROGRAMFILES%\internet explorer\iexplore.exe, 1" ' Set the comment field oShellLink.Description = "Access to the WEBPAGE Portal" oShellLink.Save ---------------------------------------------------------------------------------------------------------- To REMOVE the link I use this script: ' Set environment variables set WshShell = WScript.CreateObject("WScript.Shell" ) strDesktop = WshShell.SpecialFolders("AllUsersDesktop" ) ' delete this shortcut strShortcut = strDesktop & "\WEBPAGE.lnk" Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(strShortcut) Then fso.DeleteFile(strShortcut)
Please log in to answer
Posted by:
dugullett
11 years ago
Take a look at this link.
http://www.itninja.com/question/internet-shortcuts
Comments:
-
You can also ZIP your shortcuts. Upload them as a dependency in an Online Script.
Verify: Shortcut exists
Remediation: Unzip dependency
Dir: $(KACE_DEPENDENCY_DIR)
File: <Name of Zip.zip>
Target: %public%\desktop - dugullett 11 years ago-
This insanely simple explanation answered a lot of questions for me :)
Thank you sir. - Wildwolfay 11 years ago -
Worked great, thanks for your help. However, I cannot figure out how to included the desired icon. I've tried including it in the .zip (just puts it on the desktop) and I have tried putting it in a separate script that will drop the icon in a particular folder referenced by the shortcut. Any ideas?
***** I figured it out. What i did was create a .zip with the shortcut and the custom icon I wanted to use. I used your steps above but rather than unzip to the desktop I unzipped to the "apps" folder. (before zipping the shortcut I set the icon location for the icon to the apps folder) Then in the Remediation Success section of the script I included a .bat file that does and xcopy of the shortcut to the desktop for all users. Works great. - Robbieb 9 years ago-
My Remediation Success section doesn't give me the option to run a .bat so I just added another step to the remediation process. That part works fine but the icon still won't associate. I took my shortcut changed icon to my custom icon and then copied the shortcut into my zip folder. I then copied my custom icon into the zip folder. My script unzips to my system 32 folder and then copies the shortcut to the desktop. Did I miss something? - POB Technology 9 years ago
-
Well, one thing to check is, you have to have the custom icon in the folder you will be copying it to on "all" machines. Then, right click the shortcut on your desktop, select properties, change icon and browse to the folder where you will have the custom icon and set it. THEN zip up your shortcut, custom icon and in my case, the .bat file.
For me, I selected "add" under the On Remediation Success section, selected "launch a program, specified $(KACE_DEPENDENCY_DIR) as the directory and "ShortcutCopy.bat" as the file and saved changes. The zip file places the shortcut, custom icon and .bat file in a folder then the .bat file copies the shortcut to the desktop. - Robbieb 9 years ago -
Make sure you have Windows selected as your OS, or the .bat option will not show. - dugullett 9 years ago
-
Thanks! Your link helped a lot. I went through all of the comments and suggestions on that post and got to the answer I needed. - easterdaymatt 11 years ago
-
Ok, just tried it on WinXP, but it won't run the VB. I can't manually run the VBS and it's fine, but KACE won't call it. I'm using system variables... - easterdaymatt 11 years ago
-
What steps are you using to deploy the script? - dugullett 11 years ago
-
<compliance>
<verify on_failure="break" attempts="1">
<file_exists path="%ALLUSERSPROFILE%\Desktop" file="WEBPAGE Payment Portal.lnk" />
<on_verify_success>
<log_message type="status" message="Shortcut exists!" />
</on_verify_success>
<on_verify_failure>
<log_message type="status" message="Adding Shortcut!" />
<launch_program path="$(KACE_SYS_DIR)" program="wscript.exe" wait="true" parms="$(KACE_DEPENDENCY_DIR)\publish_WEBPAGE _link.vbs" />
<on_remediation_success>
<log_message type="status" message="Shortcut added!" />
</on_remediation_success>
<on_remediation_failure>
</on_remediation_failure>
</on_verify_failure>
</verify>
I get an error message:
there is no file extension in c:\Documents . - easterdaymatt 11 years ago
-
Ok. Rookie mistake. I added quotes around the params like
"$(KACE_DEPENDENCY_DIR)\publish_WEBPAGE _link.vbs" to make it read
""$(KACE_DEPENDENCY_DIR)\publish_WEBPAGE _link.vbs"".
The script didnt like the spaces after $(KACE_DEPENDENCY_DIR) expanded... - easterdaymatt 11 years ago