Subscribe to Windows IT Pro
December 20, 2000 12:00 AM

Permcopy and Share.vbs File Server Migration Tools

Windows IT Pro
InstantDoc ID #16252
Rating: (3)
Expedite creating and setting permissions on shares

You say it's migration time and you're rolling out Windows 2000? Then you've got a lot of work to do: Design the DNS and Active Directory (AD) structures, migrate user accounts, upgrade some servers, and scrap and replace some others. If some of those new servers are file servers, you face an old problem: copying a bunch of files and folders from a share on one machine to a share on another machine while minimizing the amount of work you need to do to recreate the file, directory, and share permissions on those file shares. Permcopy and share.vbs are two tools that can help you get started.

Permcopy.exe duplicates the share permissions that it finds on one share on another share. The syntax is

permcopy \\sourceserver sourceshare
 \\targetserver targetshare

This command duplicates the \\sourceserver\sourceshare share-level permissions on \\targetserver\targetshare.

Permcopy has four arguments: the names of the source server, source share, target server, and target share. The command's syntax is a bit nonintuitive. Rather than using Uniform Naming Convention (UNC) names for the shares, you separate each argument by at least one space from the rest of the command string. For example, to duplicate the permissions on the Mystuff share, which is on a server named Homebase, to the Yourstuff share on a server named Foreign, I wouldn't enter

permcopy \\homebase\mystuff \\foreign\yourstuff

Instead, I'd type

permcopy \\homebase mystuff \\foreign yourstuff

You need to know a few things about Permcopy. First, despite what the Microsoft Windows 2000 Resource Kit documentation says, Permcopy doesn't make the file permissions on the target directory match the file permissions on the source directory; the utility duplicates only the share permissions. Second, Permcopy doesn't copy the files from one share to the other, nor does it create shares in the target directory.

You might think, "All right, then; how will I create that new share?" You could use the GUI to create the share, of course, but let's assume that you want to perform the task on the command line and keep it as scriptable as possible. Share.vbs can list, create, and delete shares on a remote system. (Share.vbs can't set share permissions on a share; you use Permcopy to set the permissions.)

Simplified, the share.vbs syntax is

cscript share.vbs /c 
/n <sharename> 
/s <servername> 
/p <path> /t disk

For example, to create a share named Yourstuff on a server named Foreign, where Yourstuff lives in the directory C:\shares\yourstuff, you'd type

cscript share.vbs /c /n yourstuff /s foreign /p c:\shares\yourstuff /t disk

As with other resource kit scripts, you can add the /u option to specify a user name and the /w option to add a password. The /v option lets you add a comment to the share. To extend this example, suppose I had an administrative account called Czar on the Foreign server and a password of ivan. To add the user account information and a comment to the command in the above example, I could type

cscript share.vbs /c
 /n yourstuff /s foreign /p
  c:\shares\yourstuff /t disk /v "My first
   share.vbs-created share" /u czar /w ivan

Are you wondering how to remotely create directory C:\shares\yourstuff in the first place? I'll explain that in an upcoming column.

Related Content:

ARTICLE TOOLS

Comments
  • Jason
    4 years ago
    Feb 21, 2008

    I talked with Mark Minasi about your question and got the following response:

    "Looks like permcopy's not around any more, but subinacl can do those sorts of things -- it's on Microsoft's downloads site, and I've done a couple of pieces on it in the past.

    "As to remotely creating shares, I think the only possible answer would be to cook up a vbscript that exploited WMI and no, offhand I wouldn't have the first idea how, although please feel free to post a question on my forum (http://www.minasi.com/forum/)-- no doubt one of the scripting geniuses therewould have an idea.

    "Unfortunately that's the nature of Resource Kit tools... there's no guarantee that they'll work at any time, and there's no guarantee that they'll continue to exist."

  • Srinivasan
    4 years ago
    Feb 21, 2008

    where can i find permcopy & share.vbs?

  • fernandezduk
    5 years ago
    Nov 21, 2007

    could you post the location of share.vbs please.

  • juliengrajda
    8 years ago
    Jul 08, 2004

    cool

  • Ivan Tsui
    8 years ago
    May 17, 2004

    Where i could get the share.vbs?

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.