copy from old server to new server

If I have an olderserv1 going to new server1  and it has tons of folders and inside those folders 100s more that are shared, how can I copy all those folders\files along with the 100s of shares.. I used robocopy to copy the data, but it didn't create the shares, is there a way that it can create the shares too. too many to do them one by one.
LVL 5
IndyrbAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pgm554Commented:
arnoldCommented:
There are vbscripts/powershell that you can use to enumerate the shares on one system and then recreate them on the new system.

If you have server 2003 R2, DFS is one way to use domain based shares to transition between two targets using DFS-R to replicate.

presumably pgm554, might deal server transfer roles....

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorCommented:
IF the following is true then you can import the shares:
1. The drive letters match (you didn't move from the "D" drive on old server to the "F" drive on the new)
2. The are part of the same domain and local accounts (beyond standard groups such as Users and Everyone) have not been used

You can save the registry key SYSTEM\CurrentControlSet\Services\LanmanServer\Shares from the old server as a .reg file and copy it to the new server and then double-click it to import it.

If the drive letters changed then the share paths will no longer match and this won't work - so if your new server is using a different drive letter - or if you re-arranged how the data is stored on the new server, this won't really work (you can do it, but most of the shares could end up invalid).

If the shares have anything other than EVERYONE:FULL permissions and your server is in another domain or used local accounts, then those accounts will no longer match up and you'll have to manually remove all the security settings on the shares (arguably faster to reshare things then).

Depending on how you shared things in the first place, a script using NET SHARE might also work.
Discover the Answer to Productive IT

Discover app within WatchGuard's Wi-Fi Cloud helps you optimize W-Fi user experience with the most complete set of visibility, troubleshooting, and network health features. Quickly pinpointing network problems will lead to more happy users and most importantly, productive IT.

IndyrbAuthor Commented:
Can you direct me to the power she'll or vbs.. not in dfs and root folder changed/ drives
arnoldCommented:
Most of these  script examples can be found through searching, those sites in most cases can not be posted/referenced.
File server migration I think is the PGM554 link.

look at/search "migrate shares to new server" there are several examples.
ZenVenkyArchitectCommented:
Best option is to use Robocopy. This will keep NTFS permissions intact.

https://technet.microsoft.com/en-us/library/cc733145.aspx
arnoldCommented:
The issue is not with copying the files, but recreating the shares that exist on the old server on the new one into where the files were copied.
IndyrbAuthor Commented:
I cant seem to find a collective script from copying source to destination and creating the shares as is in source along with all the permissions via powershell/vbs... any code or link advice. robocopy doesn't do the shares.
arnoldCommented:
There are not combined scripts.
One deals with the transfer of the shares. I.e, enumerate the shares on the original server including the ACL/share permission settings
And the other is using robocopy/rsync to transfer the file.

You've already used robocopy to copy the files with the correct security permissions, all you need to set is the shares with the share permissions.
arnoldCommented:
If you want to alter the way the share structure is organized and have the data disbursed accordingly, that would require significantly more effort that deals with listing the share on the original saved into a CSV and then use a conversion scheme that will then go through the directory structure of the files and adjust the destinations to match the new layout for the copying as well as for creating the share....
IndyrbAuthor Commented:
any examples? scripts, csv?
arnoldCommented:
There are several, please search "script migrate shares" the links can not be posted here.

The vbscript. Wmi, powershell query the old server listing  the oS config for shares and their paths/share security settings.
The same mechanism is than used to create the shares on the new servers with oath modifications if needed using a CSV as an intermediate step.
arnoldCommented:
Powershell cmdlet wmi tie in that you can use to script the listing of shares on a system and their permissions which can then be used on the new server to setup the shares

https://technet.microsoft.com/en-us/library/035beacb-06a8-4e82-94ff-df0c8c15ac48

you would need to dig deeper into it.  If you are more familiar with vbscript, tge same process of either enumerating the shares using the wmi interface, or using the winmgt interface ....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.