Re: help writting script to copy file to every desktop



Thankx Mike but a few things here

The infrastructure department at my company is Nazi about access to group policy or the login scripts
so those 2 avenues are not a possibility.
In a way you can say I am in desktop support.
I have admin rights over every desktop but limited access to servers.
What I envisioned writing was a script that would just copy to every machine that was powered up and access the C$ share


"Mike Cook" <mcook@xxxxxxxxxxxx> wrote in message news:CF8BB163-5CFB-4314-A243-2D2AF0CEB863@xxxxxxxxxxxxxxxx
Dave

Here is a sample script that I use. I added the script to the policy assigned to the OU. You should be able to limit the scope of the copy by creating multiple versions of this script and assign them to the group policy assigned to each AD site. If site level isn't good enough, you can use a WMI query to get the computer name and make the logic flow that way. I only have a couple of sites, so I let the NETLOGON share handle the replication of the shortcuts for me. Each shortcut is only 1KB each, so the extra replication traffic is nothing.

A quick item to point out, the Scripting.FileSystemObject handles folders differently from files. If the path you send to the object ends with a backslash, that is indicating a folder. If you send a path that doesn't end with a backslash, it is a file. You will get different methods, collections, and properties for a file than you will for a folder.

Const PATH = "\\Server1\shortcut$\Division\Department\"
' Set a constant to look for the UNC to where the shortcuts are located, trailing backslash is neccessary
Const OverwriteExisting = TRUE
' Set a constant for the FileSystemObject to overwrite if necessary
set WshShell = WScript.CreateObject("WScript.Shell")
' Create a wscript.shell object to get the special folder of desktop
strDesktop = WshShell.SpecialFolders("desktop")
' Assign a string variable to the path to the user's desktopSet fso = CreateObject("Scripting.FileSystemObject")
' Create a FileSystemObject to check if the shortcut exists
Set f = fso.GetFolder(PATH)
' Get the folder object
Set fc = f.Files
' Create a collection of files in the folder object
For Each f1 in fc
' Start the loop
strItem = f1.name
If not FSO.FileExists(strDesktop & "\" & strItem) Then
' Check to see if the shortcut exists on the desktop
Set objShortcut = FSO.GetFile(PATH & strItem)
objShortcut.Copy strDesktop & "\" & strItem, OverwriteExisting
' If check fails, set a FileSystemObject to the shortcut on the network and copy it to the desktop
End If
Next

"Dave Allen" <nomail@xxxxxxxxxx> wrote in message news:ec$VM7h9HHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
I have multiple offices in my domain
In every office the desktop computer name is prefixed with the office's name
For example LA = Los Angles, NY, etc....

I need to write a .vbs that can copy a file to every machine's C: drive
based on the machine's name
I'd like to run it with command line variables like this

Domaincopy.vbs NY1- C:\Defrag.exe "C:\Documents and Settings\All
Users\Desktop\"

.



Relevant Pages

  • Re: help writting script to copy file to every desktop
    ... Then it will ping each computer to see if it is truly reachable. ... Here is a sample script that I use. ... Each shortcut is only 1KB each, so the extra replication traffic is nothing. ... You will get different methods, collections, and properties for a file than you will for a folder. ...
    (microsoft.public.scripting.vbscript)
  • Re: help writting script to copy file to every desktop
    ... I added the script to the policy assigned to the OU. ... Each shortcut is only 1KB each, so the extra replication traffic is nothing. ... You will get different methods, collections, and properties for a file than you will for a folder. ... ' Create a collection of files in the folder object ...
    (microsoft.public.scripting.vbscript)
  • Re: GPO to set desktop preferences ?
    ... course there are a lot of automation options available such as a script to ... simply a registry modification and if so script it or create a custom ADM ... file to have the setting managed through Group Policy. ... For the deployment of the shortcut try somethign like this... ...
    (microsoft.public.windows.group_policy)
  • Re: Looking for shortcut to empty trash...
    ... If you're in Panther you can a shortcut simply, ... you'll see "Empty Deleted Items Folder" menu item. ... Flip the popup to Entourage. ... Otherwise, or if pre Panther, save this script: ...
    (microsoft.public.mac.office.entourage)
  • Re: desktop shortcut via group policy
    ... I use plain old .bat files for login script. ... > I need to put a desktop shortcut for a defined global group on 1/3 of> my ... If I use the folder redirection feature in group policy,> will ... Microsoft MVP - Windows Server - Group Policy. ...
    (microsoft.public.windows.group_policy)