/build/static/layout/Breadcrumb_cap_w.png

Creating desktop shorcut for Outlook 2003 / 2007 /2010

Does anyone have a VBScript that will check what version of Office is installed and create the relevant desktop shortcut for Outlook?


0 Comments   [ + ] Show comments

Answers (1)

Posted by: aragorn.2003 10 years ago
Red Belt
0

This script should help do determine the office version

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
 ("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
 Wscript.Echo objOperatingSystem.Caption
Next

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office%'")

If colSoft.Count = 0 Then
 wscript.echo "NO OFFFICE INSTALLED"
Else

For Each objItem In colSoft
  Wscript.echo objitem.caption & ", Version" & Left(objItem.Version, InStr(1,objItem.Version,".")-1)
  exit for
  Next
End If

After determining Office you can add shortcuts similar to this script

Set obj_WshShell = WScript.CreateObject("WScript.Shell")
set obj_ShellLink = obj_WshShell.CreateShortcut(obj_WshShell.SpecialFolders("AllUsersDesktop") & "\Shortcut.lnk")

obj_ShellLink.TargetPath = obj_WshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") & "\Folder\File.exe"
obj_ShellLink.Arguments = "[IF NEEDED, OTHERWISE DELETE THIS LINE]"
obj_ShellLink.WindowStyle = 1
obj_ShellLink.IconLocation = obj_WshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") & "\Folder\File.ico"
obj_ShellLink.Description = "[PROGRAMM NAME]"
obj_ShellLink.WorkingDirectory = obj_WshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") & "\Folder\"
obj_ShellLink.Save
 
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