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)
Please log in to answer
Posted by:
aragorn.2003
10 years ago
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