This is a particular case where we have multiple profiles exist on a single machine. For example several Help Desk personal may use a single machine in rotating shifts.
If we want to copy files/folders to all the user profiles [except default profiles like admin, administrator, newuser, all users, default user etc...] then following is the script that will help in identifying multiple profiles on the machine and copying files/folders to those profiles.
You need to specify the source folder where you have kept your files to be copied.
'GET CURRENT FOLDER PATH oFolder1 = fso.GetParentFolderName(WScript.ScriptFullName) If Right(oFolder1, 1) <> "\" Then oFolder1 = oFolder1 & "\"
Good luck.
Thanks, Eshwar
Iskyfly,
Why not just run the policy once for each Logged-on user when the user logs on? That allows for permissions on the user profile.
Does anybody have a script that would do like the original script in this thread does, but for Windows 7?
I have an .ini file that I need to copy to;
users/[name]/appdata/roaming/imagenow folder (imagenow being the utilised application).
However I need it to go to all EXISTING user profiles. I know %appdata% references the CURRENT logged in user, so that won't work as I need to copy the file to each users appdating/roaming folder.
Anybody know how to go about doing this? I'm not well versed in vbscript.
Thank you!
Hope its not too late for this reply.
Task Scheduler --> create new task --> configure TRIGGER according to your requirement.
Now that ive been given a file to copy, how do I set up a task for this? That is where I am having my issue. How/where do I create the task and what are the steps.
Hi Eshwar,
The above script is working fine with me, however I need to change the source location from local
'SPECIFY THE PATH OF THE FOLDER IN WHICH SOURCE FILES RESIDE Set oFolder1 = fso.GetFolder("c:\Template")
to somthing like network share folder can you gudie me for that.
I have tried changing the local folder with network share but it was failed
'SPECIFY THE PATH OF THE FOLDER IN WHICH SOURCE FILES RESIDE Set oFolder1 = fso.GetFolder("\\192.168.1.200\Template")
this folder is shared to everyone with security perm to everyone.
Thanks.
visu2212,
This sounds like you have UAC switched on within Vista and 7. Certain parts of the hard disk are now off-limits to ordinary users (and this includes paerts of the users' own profiles!)
The problem is that this is a security issue and not something easily done (if at all possible) in a script. When you provide the Administrator password, the installer is then running inside the Administrator's user, which is why you are getting it created in the Administrator's Profile.
If you were to call the script with the end-user's entry of %USERPROFILE% such as:
wscript.exe login.vbs "%USERPROFILE%"
and then, in the script, read the parameter like this:
Dim objArgs, sTargetDir
Set objArgs = WScript.Arguments
sTargetDir = objArgs(0) & "\AppData\Roaming\Microsoft\Word\STARTUP"
Then you can use "sTargetDir" as the variable that holds your target directory for the copy.
Your main problem will be if UAC gets in the way, though.
Hope that this helps.
Kindest regards,
QuietLeni
I am having the same kind of requirement but targetted on different OS (xp, Vista & Win7)
The requirement is as follows:
My Installer will copy files to %AppData%\Microsoft\Word\STARTUP - to the profile which the user logged in.
The challenge is-------
If I logged in as a Test User, which doesnt have the elivated privilage to continue the Installation - member of Administrator group.
During Installation the Installer prompts to provide the Administrator password. Provided the Test User provides the Administrator Password, the installation will continue.
But the template files are getting copied under Administrators User Profiles instead of Test User Profile.
Administrators User Profile Location - C:\Users\Administrator\AppData\Roaming\Microsoft\Word\STARTUP
Test User Profile Location - C:\Users\Test User\AppData\Roaming\Microsoft\Word\STARTUP
Note: the same files are available under %AllUsersProfile%\Locale\WordTemplates
I want to have the files available in the LoggedIn user Profile. Can you please provide a script to do the above. Thank you very much for the extended support.
Thanks,
Viswanadh M
viswanadh.m@gmail.com
Hi,
mmm, I have created a script tocopy a folder from computer to all users profile
On error resume next Dim WSHShell, filesys Set WSHShell = WScript.CreateObject("WScript.Shell") set filesys=CreateObject("Scripting.FileSystemObject")
' copies the uninstall script filesys.Copyfolder "Rokdoc", "c:\Documents and Settings\%user%\" , TRUE
Set WSHShell = Nothing WScript.Quit(0)
I'm very new, so you may see some silly staff in my script :(
I would like to copy folder from A location ( from network drive) to 25 computer, but I need to copy that folder to thier login ID profiles.
Can you help on that?
Cheers,
Ahmed
Copy Method | CopyFolder Method | CreateTextFile Method | DeleteFile Method | MoveFile Method Applies To: FileSystemObject Object
Copies one or more files from one location to another.
object.CopyFile ( source, destination[, overwrite] )
Wildcard characters can only be used in the last path component of the source argument. For example, you can use:
[JScript] fso = new ActiveXObject("Scripting.FileSystemObject"); fso.CopyFile ("c:\\mydocuments\\letters\\*.doc", "c:\\tempfolder\\")
*
[VBScript] FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder\"
But you cannot use:
[JScript] fso = new ActiveXObject("Scripting.FileSystemObject"); fso.CopyFile ("c:\\mydocuments\\*\\R1???97.xls", "c:\\tempfolder")
[VBScript] FileSystemObject.CopyFile "c:\mydocuments\*\R1???97.xls", "c:\tempfolder"
If source contains wildcard characters or destination ends with a path separator (\), it is assumed that destination is an existing folder in which to copy matching files. Otherwise, destination is assumed to be the name of a file to create. In either case, three things can happen when an individual file is copied.
An error also occurs if a source using wildcard characters doesn't match any files. The CopyFile method stops on the first error it encounters. No attempt is made to roll back or undo any changes made before an error occurs.
Copy Method | CopyFolder Method | CreateTextFile Method | DeleteFile Method | MoveFile Method
Dim fso Dim oFolder1, objFolder, oFolderDim pathDim WSHShellDim colFoldersDim sDocsAndSettings Dim strComputerstrComputer = "."Set WSHShell = CreateObject("WScript.Shell")Set fso = createobject("Scripting.FileSystemObject")'SPECIFY THE PATH OF THE FOLDER IN WHICH SOURCE FILES RESIDESet oFolder1 = fso.GetFolder("c:\Template")'COPY FILES TO USER PROFILESsDocsAndSettings = "C:\Documents and Settings" Set colFolders = fso.GetFolder(sDocsAndSettings) For Each oFolder In colFolders.SubFolders Select Case LCase(oFolder.Name) Case "admin", "administrator", "newuser", "all users", "default user.original", "localservice", "networkservice" 'LEAVE THE DEFAULT PROFILES ON THE MACHINE Case Else ' Check for the path If fso.FolderExists(sDocsAndSettings & oFolder.Name & "\Application Data") Then 'COPY FOLDER TO USER PROFILE fso.CopyFolder oFolder1, sDocsAndSettings & oFolder.Name & "\Application Data\Microsoft\Templates" ,True End If End Select NextSet fso = NothingSet WSHShell = Nothing