|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Trying to copy files\folders to UserProfile\Application Data
I'm trying to write a script for an SMS job that will copy files\folders to a
users profile application data. How can I insure that the files\folders are copied to any users profile in C:\Documents and Settings excluding the default profiles (Administrator, All Users, Default User). "Itencypt" wrote: pls run this in command prompt. if works, replace the source path and remove > I'm trying to write a script for an SMS job that will copy files\folders to a > users profile application data. How can I insure that the files\folders are > copied to any users profile in C:\Documents and Settings excluding the > default profiles (Administrator, All Users, Default User). > "@echo". for /f "usebackq delims=" %a in (`"dir "c:\Documents and Settings" /a /b | findstr /v /i /c:"Administrator" /c:"default user" /c:"all user" /c:"localservice" /c:"networkservice""`) do @echo xcopy d:\source\* /s "c:\Documents and Settings\%a\Application Data\" "Itencypt" wrote: for /f "usebackq delims=" %a in (`"dir "c:\Documents and Settings" /a /b | > I'm trying to write a script for an SMS job that will copy files\folders to a > users profile application data. How can I insure that the files\folders are > copied to any users profile in C:\Documents and Settings excluding the > default profiles (Administrator, All Users, Default User). > findstr /v /i /c:"Administrator" /c:"default user" /c:"all user" /c:"localservice" /c:"networkservice""`) do @echo xcopy d:\source\* "c:\Documents and Settings\%a\Application Data\" /s Perhaps it will be easier for me if I provided what I have now that's not
working and hope someone can fix it. Below is the part of the script that I have that's not working including the variables that have been set. ---------------Code Begin------------------------- Option Explicit Dim ws, wn, fs, AllUsersProgramsMenu, AllUsersDesktop, AllUserStartMenu Dim Progfiles, SystemRoot, UserProfile, UserDesktop, CurrentPath, AllProfiles, DefaultUser Dim WindowsDir, ComputerName, sDate, TempDir, objEnv, UIMODE, Proceed, Quotes Dim colNamedArguments, ScriptVer, AppVersion, ApplicationName, InstallerName Dim getprofilefolder, eachprofile, OSType Set ws = WScript.CreateObject("WScript.Shell") Set wn = WScript.CreateObject("WScript.Network") Set fs = CreateObject("Scripting.FileSystemObject") sDate = Now AllUsersProgramsMenu = ws.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu\Programs" AllUsersDesktop = ws.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Desktop" AllUserStartMenu = ws.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu\Programs" Progfiles = ws.ExpandEnvironmentStrings("%ProgramFiles%") SystemRoot = ws.ExpandEnvironmentStrings("%SystemRoot%") UserProfile = ws.ExpandEnvironmentStrings("%UserProfile%") DocAndSet = ws.ExpandEnvironmentStrings("C:\Documents and Settings") DefaultUser = ws.ExpandEnvironmentStrings("C:\Documents and Settings\Default User") UserDesktop = ws.ExpandEnvironmentStrings("%USERPROFILE%") & "\Desktop" CurrentPath = fs.GetFile(Wscript.ScriptFullName).ParentFolder & "\" WindowsDir = ws.ExpandEnvironmentStrings("%windir%") ComputerName = UCase(ws.ExpandEnvironmentStrings("%COMPUTERNAME%")) TempDir = ws.ExpandEnvironmentStrings("%TEMP%") & "\" Quotes = CHR(34) ''Copy the Folder to each profile AllProfiles = ws.ExpandEnvironmentStrings("%SystemDrive%") & "\Documents and Settings" set getprofilefolder = fs.GetFolder(AllProfiles) set eachprofile = getprofilefolder.Subfolders For Each profilefolders in eachprofile fs.copyfolder CurrentPath & "FolderName", (profilefolders & "\Application Data\FolderName") 'fs.CopyFolder (CurrentPath & "FolderName"), (DefaultUser & "\Application Data\FolderName"), True ----------------------Code End------------------------------------ |
|||||||||||||||||||||||