JSI Tip 6429. How do I list, create, or delete shares from a local or remote computer?

The preferred method for creating a file system share is to use RMTShare.EXE, because it can also grant permission on the share.

The Kit Supplement contains Share.VBS, which can list, create, or delete shares from a local or remote computer. The syntax is:

1.  Share.vbs /L \[/S <server>\] \[/U <username>\] \[/W <password>\]
                 \[/O <outputfile>\]
2.  Share.vbs /C /N <name> /P <path> \[/T <type>\] \[/V <description>\]
             \[/S <server>\] \[/U <username>\] \[/W <password>\]
             \[/O <outputfile>\]
3.  Share.vbs /D /N <name>
             \[/S <server>\] \[/U <username>\] \[/W <password>\]
             \[/O <outputfile>\]

PARAMETER SPECIFIERS:
   /L            Lists all shares on a machine.
   /C            Creates a share on a machine.
   /D            Deletes a share from a machine.
   name          Name of the share to be created or deleted.
   path          Path of the share to be created.
   description   A description for the share.
   type          Type of the share to be created. Must be one
                 one of Disk, Printer, IPC, Special.
   server        A machine name.
   username      The current user's name.
   password      Password of the current user.
   outputfile    The output file name.

EXAMPLE:
1. cscript Share.vbs /l /s MyMachine2
   List the shares on the machine MyMachine2.
2. cscript Share.vbs /c /n scratch /p c:\scratch /t Disk /v "Scratch Directory"
   Creates a file share called "scratch" on the local machine.
3. cscript Share.vbs /d /n scratch /s MyMachine2.
   Deletes the share named "scratch" on the machine MyMachine2.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish