+ Post New Thread
Page 3 of 3 FirstFirst 123
Results 31 to 40 of 40
How do you do....it? Thread, Creating Shortcuts for 32 and 64 bit computers in Technical; Originally Posted by Arthur You're old! I use a modified* version of @ jklight 's PowerShell script to do our ...
  1. #31
    Duke5A's Avatar
    Join Date
    Jul 2010
    Posts
    818
    Thank Post
    84
    Thanked 136 Times in 116 Posts
    Blog Entries
    8
    Rep Power
    32
    Quote Originally Posted by Arthur View Post
    You're old!

    I use a modified* version of @jklight's PowerShell script to do our Start Menu. Copying shortcuts into a folder is far easier than having to modify a script each time you want to add another program. Since the script automatically deletes shortcuts that do not exist, you could put both 32-bit and 64-bit shortcuts in the same folder (although obviously they can't have the same name).

    Btw, wouldn't your script set "strProgramFilesPath" to the wrong location if it was run on a PC with a 64-bit processor and a 32-bit OS? Surely you should be checking the OS architecture rather than the processor architecture?

    Code:
    If GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 Then
    	strProgramFilesPath = "C:\Program Files (x86)"
    Else
    	strProgramFilesPath = "C:\Program Files"
    End If
    * The script I am using is different from the one posted in the linked thread. It has several improvements like removing empty folders that do not contain any shortcuts and uses the existing Start Menu folder rather than create a new one.
    ...and apparently a little senile too, good catch!

    Code:
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set WshShell = CreateObject("WScript.Shell")
    
    strAllDesktopPath = WshShell.SpecialFolders("AllUsersDesktop")
    strUserDesktopPath = WshShell.SpecialFolders("Desktop")
    
    
    Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
    
    For Each objItem in colItems
    	If InStr(objItem.OSArchitecture, "64") Then
    		strProgramFilesPath = "C:\Program Files (x86)"
    	Else
    		strProgramFilesPath = "C:\Program Files"
    	End If
    Next
    
    On Error Resume Next
    
    If objFSO.FileExists(strUserDesktopPath & "\My Shortcut.lnk") Then
    Else
    	Set objShortcutUrl = WshShell.CreateShortcut(strUserDesktopPath & "\My Shortcut.lnk")
    	objShortcutUrl.TargetPath = strProgramFilesPath & "\" & "My Program" & "\" & "Program.exe"
    	objShortcutUrl.WorkingDirectory = strProgramFilesPath & "\" & "My Program"
    	objShortcutUrl.IconLocation = strProgramFilesPath & "\" & "My Program" & "\" & "Program.exe,0"
    	objShortcutUrl.Save
    End If
    Our logon script is VB and has been since the days of Win2k; if I was starting over it would most certainly be Power Shell. The way it sits now it handles drive mappings, printer load outs, icon creation, quick fixes, etc. I've become addicted to the granular control scripting has over using GPP. The initialization sub in the logon script pulls username, computer name, user group membership, and LDAP paths for both users and computers.

  2. #32

    witch's Avatar
    Join Date
    Nov 2005
    Location
    Dorset
    Posts
    11,208
    Thank Post
    1,454
    Thanked 2,515 Times in 1,752 Posts
    Rep Power
    755
    None of that helps me - far too complicated - I feel like someone who thought they were going to play a scale but were expected to play a symphony!
    I don't have a logon script anymore. I know nothing about Power Shell

  3. #33
    Boredguy's Avatar
    Join Date
    Jun 2011
    Location
    Swindon
    Posts
    635
    Thank Post
    4
    Thanked 140 Times in 131 Posts
    Rep Power
    52
    You say you have redirection for shortcuts, where are they being redirected to?
    If it is to a network location, you could have two different folders, one for 32 bit and one for 64 bit, and use the Group Policy Folder Redirection to direct the start menu based on group membership of the computer the user is on.

    Having two folders is about as simple as I can think of, which is what we do here, but we use a PowerShell script at start-up that tells the computer to go off to our central repository and copy down only the shortcuts that are available on the computer.

  4. Thanks to Boredguy from:

    witch (4th April 2014)

  5. #34

    Join Date
    Mar 2013
    Location
    Northampton
    Posts
    102
    Thank Post
    16
    Thanked 32 Times in 22 Posts
    Rep Power
    9
    Quote Originally Posted by witch View Post
    None of that helps me - far too complicated - I feel like someone who thought they were going to play a scale but were expected to play a symphony!
    I don't have a logon script anymore. I know nothing about Power Shell
    I've never done this myself so someone may be able to correct me and it may also not work with your set up.

    You may be able to have your two shortcuts then create two GPP shorcut rules that delete the shortcut for the opposite architecture, leaving a cleaner Start menu.
    Use Item level targeting under the common tab and check for the environment variables of Program files and Program Files(x86).

    So for example one GPP rule would check if Program Files(x86) exists, if it does it means it's a 64-bit machine and the 32-bit shortcut can be deleted. The other GPP rule would check if Program Files(x86) doesn't exist then delete the 64-bit shortcut.

    You could also use it to add the relevent shortcut if you can't delete the shorcut e.g. folder redirection.


    Here's the TechNet page on Item Level Targetting
    Preference Item-Level Targeting

    Just found a thread that looks like what you are looking for
    Deploying desktop shortcuts via GP for 32-bit programs on 64-bit O/S - Spiceworks
    Last edited by madurham; 4th April 2014 at 01:00 PM.

  6. #35

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,223
    Thank Post
    893
    Thanked 1,775 Times in 1,531 Posts
    Blog Entries
    12
    Rep Power
    461
    Quote Originally Posted by Boredguy View Post
    You say you have redirection for shortcuts, where are they being redirected to?
    If it is to a network location, you could have two different folders, one for 32 bit and one for 64 bit, and use the Group Policy Folder Redirection to direct the start menu based on group membership of the computer the user is on.

    Having two folders is about as simple as I can think of, which is what we do here, but we use a PowerShell script at start-up that tells the computer to go off to our central repository and copy down only the shortcuts that are available on the computer.

    Use a WMI filter so you don't need to mess about with groups. We store our redirected folders on the local machines.

  7. #36
    AlexB's Avatar
    Join Date
    Jul 2006
    Location
    Warwickshire
    Posts
    398
    Thank Post
    40
    Thanked 45 Times in 40 Posts
    Rep Power
    24
    I'm afraid I'd go really simple...

    the variables %programfiles% and %programfiles(x86)% aren't useful, but if you create a new one, e.g. %programfiles32bit% (which I strongly feel should be part of the OS defaults) and set it to c:\program files on 32 bit machines and c:\program files (x86) on 64 bit machines and just have your shortcuts use %programfilesbit%

    (This could also be done by adding %programfiles(x86)% to 32 bits machines)
    Last edited by AlexB; 4th April 2014 at 01:38 PM.

  8. #37

    witch's Avatar
    Join Date
    Nov 2005
    Location
    Dorset
    Posts
    11,208
    Thank Post
    1,454
    Thanked 2,515 Times in 1,752 Posts
    Rep Power
    755
    Quote Originally Posted by AlexB View Post
    . and set it to c:\program files on 32 bit machines and c:\program files (x86) on 64 bit machines
    (This could also be done by adding %programfiles(x86)% to 32 bits machines)
    Sorry, what do you mean by "set it" in this context?

  9. #38

    Ephelyon's Avatar
    Join Date
    Aug 2008
    Location
    Cheshire, England
    Posts
    1,741
    Thank Post
    311
    Thanked 355 Times in 216 Posts
    Rep Power
    147
    I think @DrCheese's solution is the right one. It's what we use here too.

    You can put this in a startup script for all workstations:

    Code:
    @wmic os get osarchitecture | find "32" && if not exist "C:\Program Files (x86)" mklink /j "C:\Program Files (x86)" "C:\Program Files"
    Then you can have a single redirected Start Menu with shortcuts that only point to the (x86) version of everything... assuming you have no specifically 64-bit software to link to, that is.
    Last edited by Ephelyon; 4th April 2014 at 10:57 PM.

  10. #39

    Join Date
    Feb 2013
    Location
    South West England
    Posts
    207
    Thank Post
    0
    Thanked 34 Times in 30 Posts
    Rep Power
    32
    Quote Originally Posted by snagrat View Post

    Create a GPO that sets an Windows Environment of programfiles(x86) and value C:\Program Files.

    Then point shortcuts to %programfiles(x86)%\dir\.exe

    Give it ago. Once setup it just works.
    Have you tried this? I do it at all my schools just in case different bit systems are introduced and it works.

  11. #40
    AlexB's Avatar
    Join Date
    Jul 2006
    Location
    Warwickshire
    Posts
    398
    Thank Post
    40
    Thanked 45 Times in 40 Posts
    Rep Power
    24
    Quote Originally Posted by witch View Post
    Sorry, what do you mean by "set it" in this context?
    GPO
    Computer->Preferences->Windows Settings->Environment
    New environment variable
    System variable
    Name: programfiles(x86)
    Value: C:\Program Files

    Set GPO with a 32bit Architecture filter

  12. Thanks to AlexB from:

    witch (22nd April 2014)

SHARE:
+ Post New Thread
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 9
    Last Post: 26th February 2013, 04:34 PM
  2. Best practice for setting up programs for 32-bit and 64-bit use
    By JohnnyJet in forum Windows Server 2008 R2
    Replies: 0
    Last Post: 28th November 2012, 10:22 AM
  3. Replies: 0
    Last Post: 7th March 2012, 11:51 AM
  4. Win 7 - 32 or 64 Bit
    By Paid_Peanuts in forum Windows 7
    Replies: 11
    Last Post: 7th August 2009, 05:37 PM
  5. Start Menu: Pinned Shortcuts for Internet and Outlook
    By burgemaster in forum Windows Vista
    Replies: 6
    Last Post: 1st April 2009, 03:13 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •