Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Desktop Icon GPO

Posted on 2012-03-30
4
Medium Priority
?
905 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

670 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