+ Post New Thread
Results 1 to 6 of 6
Scripts Thread, Script help - copying shortcuts to Win7 AND XP All Users Desktops? in Coding and Web Development; Hi all (yet again.) I've come across a problem with this script I've knocked up which works for XP in ...
  1. #1

    Miscbrah's Avatar
    Join Date
    Dec 2011
    Posts
    1,021
    Thank Post
    291
    Thanked 298 Times in 180 Posts
    Rep Power
    124

    Script help - copying shortcuts to Win7 AND XP All Users Desktops?

    Hi all (yet again.)

    I've come across a problem with this script I've knocked up which works for XP in copying desktop shortcuts, but not for Windows 7:

    Code:
    sSource = "\\lhsdc1\netlogon\staffdesktop\*" 
    set oWShell = createobject("Wscript.Shell") 
    sDestination = oWShell.SpecialFolders("AllUsersDesktop") 
    set oFSO = createobject("Scripting.FileSystemObject") 
    oFSO.CopyFile sSource, sDestination, True
    I get a 800a0046 permission denied message on Windows 7. Not the best at scripting to be honest, and not sure how to go about making this work for 7 and XP together. I'm guessing some sort of variable based on OS? Is there some dodgy WMI-filtered alternative if using 7 and XP together? Would much rather have just the one script doing the business though, so if anyone can help me I'd be extremely grateful.

    Like, beer grateful.

  2. #2
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,291
    Thank Post
    219
    Thanked 238 Times in 206 Posts
    Rep Power
    76
    You might find that it is UAC on Windows 7 that is causing that problem. If you try copying and pasting things onto the Public\Desktop folder you will get a prompt to confirm you want to do this - sucks I know. Try disabling UAC and see if you script works, at least you will know you have the syntax correct. Then its a case of allowing it to run with Admin permissions

  3. Thanks to themightymrp from:

    Miscbrah (11th May 2012)

  4. #3

    Miscbrah's Avatar
    Join Date
    Dec 2011
    Posts
    1,021
    Thank Post
    291
    Thanked 298 Times in 180 Posts
    Rep Power
    124
    Hi! Thanks for getting back to me so quick! - no still getting those permission problems even with UAC off in GP.

    How do I run it with admin permissions btw?

  5. #4
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,291
    Thank Post
    219
    Thanked 238 Times in 206 Posts
    Rep Power
    76
    Not 100% sure but I think you can download a program called elevate32.exe (or elevate64.exe) from MS which you can call in a script. Have you considered using Group Policy Preferences to create the shorcut on the desktop?

    Or, if you do a bit of an "if exist" routine, you can set the destination to the all users desktop using this line:

    Code:
    sDestination = "c:\users\public\desktop\"

  6. #5
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,291
    Thank Post
    219
    Thanked 238 Times in 206 Posts
    Rep Power
    76
    Try this:

    Code:
    sSource = "\\lhsdc1\netlogon\staffdesktop\*" 
    set oWShell = createobject("Wscript.Shell")
    
    Dim objFSO
     
    Set objFSO = CreateObject("Scripting.FileSystemObject")
     If objFSO.FolderExists("c:\users\public\desktop") Then
         sDestination = "c:\users\public\desktop\"
     Else
         sDestination = "c:\documents and settings\all users\desktop\"
     End If
    
    set oFSO = createobject("Scripting.FileSystemObject") 
    oFSO.CopyFile sSource, sDestination, True

  7. #6

    Miscbrah's Avatar
    Join Date
    Dec 2011
    Posts
    1,021
    Thank Post
    291
    Thanked 298 Times in 180 Posts
    Rep Power
    124
    Quick workaround I've got (just in case anyone from Google sees this) is by applying the same script as a machine startup policy, then applying WMI filters in GP for XP at logon time, then Win7 at startup.

    Clunky and stuff, but works.

    EDIT - gah missed that reply! Cheers, will give that a go
    Last edited by Miscbrah; 11th May 2012 at 02:18 PM.

  8. Thanks to Miscbrah from:

    themightymrp (11th May 2012)



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 5
    Last Post: 31st January 2012, 11:22 AM
  2. Copy shortcut to all users on active directory
    By punktilend in forum How do you do....it?
    Replies: 2
    Last Post: 30th November 2011, 08:46 PM
  3. [XP] All Users start menu / desktop
    By Psymon in forum Windows
    Replies: 4
    Last Post: 28th April 2009, 03:31 PM
  4. Once and for all - Active Desktop
    By amfony in forum Windows
    Replies: 2
    Last Post: 15th March 2009, 03:46 PM
  5. Replies: 12
    Last Post: 12th September 2005, 11:47 AM

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
  •