Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup all user folders to server - domain environment

Status
Not open for further replies.
Oct 7, 2007
6,597
US
I'm terrible with scripting, so don't laugh. This is a script I use all the time for copying user documents and desktop to a server/NAS/external drive because they don't always save things on the server. Don't want to do FOLDER redirection.

robocopy.exe "C:\users\user\My Documents" "\\server\Pcbackups\user\Documents" /MIR /FFT /TEE /ZB /R:2 /W:5 /LOG:"C:\Backup.log"
robocopy.exe "C:\users\user\desktop" "\\server\Pcbackups\user\Desktop" /MIR /FFT /TEE /ZB /R:2 /W:5 /LOG+:"C:\Backup.log"

Is there a way to include every user on the computer, given that you don't know what users may have actually logged into the computer via the domain and created a profile? You can offer a better/smarter way, the script just shows what I'm after.

"Living tomorrow is everyone's sorrow.
Modern man's daydreams have turned into nightmares.
 
Im going to go ahead and ask... why not use folder redirection? Kinda seems like it is exactly what you want it to do and you dont have to script it other than rocking a Group Policy and setting accordingly.

Learning - A never ending quest for knowledge usually attained by being thrown in a situation and told to fix it NOW.
 
I guess I read some bad things about doing it that way. Plus the main reason - the users don't have any home directories at this point because the owner didn't want everyone to have their own private folder. So, I was going to do a backup to the server under the radar and without anyone knowing that they have a place on the server. Complicated situation.

"Living tomorrow is everyone's sorrow.
Modern man's daydreams have turned into nightmares.
 
We use folder redirection here and the only real issue we had was there were roaming profiles before and going the redirection route made it a bit of a mess when switching from one to the other. I personally love redirection. It allows all of our important docs, we redirect Desktop and Documents only, for each user to be on a RAID solution with nightly backup and replication. I understand that might not be the way you or that company wants to go but you are essentially doing it with robocopy anyway.

Am I correct in assuming this is in an AD environment? Are there a handful of "group" computers where many people could log into or is it kind of a revolving user base on all of the PCs?

Learning - A never ending quest for knowledge usually attained by being thrown in a situation and told to fix it NOW.
 
Domain environment - Microsoft Windows Server 2012 Essentials. Most people have a single computer that they always sit at, but occasionally people go into a different office for privacy and login on another PC.

I guess I should take a look at doing the folder redirection since it's technically the RIGHT way to do it. The owner of the company is kind of dumb though. We have his main database on the server and his QuickBooks files being backed up, but virtually nothing else. Incredibly stupid to buy a server, create a domain, add all the computers to the domain and then not worry about the documents that users are saving locally and NOT being backed up. I just wish I could beat this particular owner with a stick!

"Living tomorrow is everyone's sorrow.
Modern man's daydreams have turned into nightmares.
 
Ive worked with one set of owners that were somewhat similar. You might need a very big stick to get your view across on those types.

I would push towards the Folder Redirection if it was me but to help with your actual question:

From Powershell on the PC in question you can enter the bold section and it should spit out something similar to what is typed below it:

PS C:\Users\robw.zanders> Get-WmiObject win32_userprofile | select localpath, sid

localpath sid

——— —

C:\Users\Admin S-1-5-21-1266540227-3509270964-2815946151-500

C:\Users\defaultuser0 S-1-5-21-1266540227-3509270964-2815946151-1001

C:\Users\Administrator S-1-5-21-124525095-708259637-1543119021-179756

C:\Users\robw.zanders S-1-5-21-124525095-708259637-1543119021-179744

C:\Windows\ServiceProfiles\NetworkService S-1-5-20

C:\Windows\ServiceProfiles\LocalService S-1-5-19

C:\windows\system32\config\systemprofile S-1-5-18

Learning - A never ending quest for knowledge usually attained by being thrown in a situation and told to fix it NOW.
 
Sorry didnt complete my thought. With this info, we should be able to create a script based on the info received. I assume now that you would't have wanted a custom script for each machine but a blanket script with basically a variable for the Users on each machine. Pretty sure there is a way to do that via Powershell since you can store variables. Ill keep my nose to the grindstone unless you cut bait and go the FR route.

Learning - A never ending quest for knowledge usually attained by being thrown in a situation and told to fix it NOW.
 
a blanket script with basically a variable for the Users on each machine
Yes, something to accommodate whatever users might possibly have logged into any given computer.
Thanks for the help. I guess I should tell the owner that Folder Redirection is much simpler, native to Microsoft and probably would take less time to implement. Which should be big to him because he's a penny pincher.

Assumption: Shouldn't be a problem with Outlook 2013 OST files (Outlook configured for IMAP accounts) because the OST location is NOT in the DOCUMENTS folder, unlike if it was a PST file.

"Living tomorrow is everyone's sorrow.
Modern man's daydreams have turned into nightmares.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top