Login to participate
Endpoint Management & Virtualization DownloadsRSS

Script to Copy Files/Folders to All the User Profiles on the Machine

Eshwar's picture

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.

Note: If you are planning to run this script as part of software delivery task, follow the instructions below.
  • Make sure that Source folder and script lies in the same location
  • Modify the script to look for the source folder in CURRENT FOLDER
'GET CURRENT FOLDER PATH
oFolder1 = fso.GetParentFolderName(WScript.ScriptFullName)
If Right(oFolder1, 1) <> "\" Then oFolder1 = oFolder1 & "\"

Good luck.

Thanks,
Eshwar

License: AJSL
By clicking the download link below, you agree to the terms and conditions in the Altiris Juice Software License
Support: User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.
Stevo77's picture

I've amended the script to

I've amended the script to send a ppt file to every users profile. However it is not copying the file and the script doesn't error.

Can anyone help?

Dim fso 
Dim oFolder1, objFolder, oFolder
Dim path
Dim WSHShell
Dim colFolders
Dim sDocsAndSettings 
Dim strComputer

strComputer = "."

Set WSHShell = CreateObject("WScript.Shell")
Set fso = createobject("Scripting.FileSystemObject")

'SPECIFY THE PATH OF THE FOLDER IN WHICH SOURCE FILES RESIDE
Set oFolder1 = fso.GetFolder("c:\Template")

'COPY FILES TO USER PROFILES
sDocsAndSettings = "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 
Next

Set fso = Nothing
Set WSHShell = Nothing

Eshwar's picture

sure

Stevo77,
Sorry for the late reply.
You forgot to mention "\" in the script.
Here it is

sDocsAndSettings = "C:\Documents and Settings"

You should keep "\" at the end like below

sDocsAndSettings = "C:\Documents and Settings\"

Now your script will work like a Champ.

Good luck.
Eshwar

Thanks,
Eshwar