Solved

Desktop Icon GPO

Posted on 2012-03-30
4
902 Views
Last Modified: 2012-04-17
Hi Experts,

I am currently using the below script to deploy desktop icons to a mixture of PCs at my clients school via GPO. The server is 2008 and the PCs are winxp and win7. The winxp are using office 2003 and the win7 are using office2010. The issue i have is that the below script cannot tell the difference between office11 and office14 in the regsitry settings, can anyone help me alter the script to be able to do that?

'MS Word
Set WSHShellMSW = WScript.CreateObject("WScript.Shell")
'Dim MyShortcut, MyDesktop, DesktopPath
'DesktopPath = WSHShell.SpecialFolders("Desktop")
sUsersProfileMSW = WshShellMSW.ExpandEnvironmentStrings("%USERPROFILE%")
Set MyShortcutMSW = WSHShellMSW.CreateShortcut(sUsersProfileMSW & "\desktop\MicrosoftWord.lnk")
MyShortcutMSW.TargetPath = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office14\WINWORD.exe")
MyShortcutMSW.WorkingDirectory = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office14\")
MyShortcutMSW.WindowStyle = 4
MyShortcutMSW.IconLocation = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office14\WINWORD.exe, 0")
MyShortcutMSW.Save
0
Comment
Question by:ncomper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
HaiFai earned 500 total points
ID: 37786568
Hi

This probably does what you want

'MS Word
Set WSHShellMSW = WScript.CreateObject("WScript.Shell")
set fs=CreateObject("Scripting.FileSystemObject")
'Dim MyShortcut, MyDesktop, DesktopPath
'DesktopPath = WSHShell.SpecialFolders("Desktop")
sUsersProfileMSW = WshShellMSW.ExpandEnvironmentStrings("%USERPROFILE%")
Set MyShortcutMSW = WSHShellMSW.CreateShortcut(sUsersProfileMSW & "\desktop\MicrosoftWord.lnk")

'32 bit office 2010 in 32bit system 
If fs.FolderExists("C:\Program Files\Microsoft Office\Office14") Then
MyShortcutMSW.TargetPath = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office14\WINWORD.exe")
MyShortcutMSW.WorkingDirectory = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office14\")
MyShortcutMSW.WindowStyle = 4
MyShortcutMSW.IconLocation = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office14\WINWORD.exe, 0")
MyShortcutMSW.Save
End If

'32 bit office 2010 in 64bit system 
If fs.FolderExists("C:\Program Files (x86)\Microsoft Office\Office14") Then
MyShortcutMSW.TargetPath = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.exe")
MyShortcutMSW.WorkingDirectory = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files (x86)\Microsoft Office\Office14\")
MyShortcutMSW.WindowStyle = 4
MyShortcutMSW.IconLocation = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.exe, 0")
MyShortcutMSW.Save
End If

'32 bit office 2003 in 32bit system 
If fs.FolderExists("C:\Program Files\Microsoft Office\Office11") Then
MyShortcutMSW.TargetPath = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office11\WINWORD.exe")
MyShortcutMSW.WorkingDirectory = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office11\")
MyShortcutMSW.WindowStyle = 4
MyShortcutMSW.IconLocation = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office11\WINWORD.exe, 0")
MyShortcutMSW.Save
End If

'32 bit office 2003 in 64bit system 
If fs.FolderExists("C:\Program Files (x86)\Microsoft Office\Office11") Then
MyShortcutMSW.TargetPath = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files (x86)\Microsoft Office\Office11\WINWORD.exe")
MyShortcutMSW.WorkingDirectory = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files (x86)\Microsoft Office\Office11\")
MyShortcutMSW.WindowStyle = 4
MyShortcutMSW.IconLocation = WSHShellMSW.ExpandEnvironmentStrings("C:\Program Files (x86)\Microsoft Office\Office11\WINWORD.exe, 0")
MyShortcutMSW.Save
End If

Open in new window

0
 
LVL 5

Author Comment

by:ncomper
ID: 37786584
Perfect thanks for your prompt reply, i will put it to the test and confirm shortly.
0
 
LVL 5

Author Comment

by:ncomper
ID: 37855761
Hi,

Thanks for the above, that works perfectly. I am looking to put other desktop icons in the script too, Excel, PowerPoint and Access. How easy would this be to implement, will i need to match the above for every separate MS Office icon?
0
 
LVL 5

Author Closing Comment

by:ncomper
ID: 37855930
I have managed to replicate the same to all icons and have got Word, Excel, PowerPoint, Access, Publisher and Picture Manager working.

Thank you for you help, saved me a real headache.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question