Solved

Desktop Icon GPO

Posted on 2012-03-30
4
899 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
  • 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using 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…

840 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