Hello, We have about 50 computers that have an admin user and then a standard user that is one of a string, we'll call johndoe1,johndoe2.....johndoe50. Is there a way to write a script that pulls the profile that starts with "johndoe" then copy files to a location on that profile? Any assistance is appreciated.
for /L %%a in (1,1,50) do (
echo y |DEL "C:\Documents and Settings\johndoe%%a\Desktop\*.*"
rmdir /s /q "C:\Documents and Settings\johndoe%%a\Local Settings\Temp"
echo y |DEL "C:\Documents and Settings\johndoe%%a\My Documents\My Pictures\*.*"
echo y |DEL "C:\Documents and Settings\johndoe%%a\Cookies\*.*"
echo y |DEL "C:\Documents and Settings\johndoe%%a\Start Menu\Programs\Startup\*.*"
echo y |DEL "C:\Documents and Settings\johndoe%%a\My Documents\*.*
)
:end
more code will be needed, but this is where I would start.
I could do it using group policy but we'd be restricted to running the script every logon/logoff or startup/shutdown when I'd rather run the script every day using a scheduled task if possible.
What are you attempting to do? There might be a better way to go about it, or it might be more challenging with VBScript.
I actually wrote the wrong thing in my original post. I'm not trying to copy files to the profile, I'm trying to delete temporary files and clear the desktop, my docs, etc from a specific user profile on each computer. We have 1 user per computer(besides local and network admin users) going from johndoe1 to johndoe50. I have the batch code below that I use and it works but would like to have a generic file that can look up the usernames, pick out the johndoe user, and delete files from that profile. I used %username% and that works only for the user that is logged in but I need it to be able to run without being logged in. Sorry if this is confusing and jumbled but any help is much appreciated! echo y |DEL "C:\Documents and Settings\johndoe1\Desktop\*.*"
rmdir /s /q "C:\Documents and Settings\johndoe1\Local Settings\Temp"
echo y |DEL "C:\Documents and Settings\johndoe1\My Documents\My Pictures\*.*"
echo y |DEL "C:\Documents and Settings\johndoe1\Cookies\*.*"
echo y |DEL "C:\Documents and Settings\johndoe1\Start Menu\Programs\Startup\*.*"
echo y |DEL "C:\Documents and Settings\johndoe1\My Documents\*.*
for /L %%a in (1,1,50) do (
echo y |DEL "C:\Documents and Settings\johndoe%%a\Desktop\*.*"
rmdir /s /q "C:\Documents and Settings\johndoe%%a\Local Settings\Temp"
echo y |DEL "C:\Documents and Settings\johndoe%%a\My Documents\My Pictures\*.*"
echo y |DEL "C:\Documents and Settings\johndoe%%a\Cookies\*.*"
echo y |DEL "C:\Documents and Settings\johndoe%%a\Start Menu\Programs\Startup\*.*"
echo y |DEL "C:\Documents and Settings\johndoe%%a\My Documents\*.*
)
:end
more code will be needed, but this is where I would start.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |