Share.vbs (Resource Kit)

List or edit a file share or print share (on any computer)

Although missing from recent Resource Kits, this VBS script does still work under recent versions of Windows. The preferred method for creating shares is the RMTShare command, which can also grant permissions.

Syntax:
 List Shares
        Share.vbs /L [/S <server>] [/U <username>] [/W <password>] [/O <outputfile>]
Create a Share
Share.vbs /C /N <name> /P <path> [/T <type>] [/V <description>]
[/S <server>] [/U <username>] [/W <password>] [/O <outputfile>] Delete a Share
Share.vbs /D /N <name>
[/S <server>] [/U <username>] [/W <password>] [/O <outputfile>] Key:
/L List
/C Create
/D Delete /N name Name of the share to be created or deleted.
/P path Path of the share to be created.
/v description A description for the share.
/T type Type of the share to be created. (Disk, Printer, IPC or Special)
/S server A machine name.
/U username The current user's name.
/W password Password of the current user.
/O outputfile Output file name.

Examples

List the shares on the machine \\Frodo

cscript Share.vbs /L /s Frodo

Create a file share called "scratch" on the local machine:

cscript Share.vbs /c /n scratch /p "c:\my shared files" /t Disk /v "project files"

Delete the share named "scratch" on the machine \\Frodo

cscript Share.vbs /d /n scratch /s Frodo

"The inherent vice of capitalism is the unequal sharing of blessings, the inherent vice of Socialism is the equal sharing of miseries" ~ Winston Churchill

Related commands

CACLS - Display or modify Access Control Lists (ACLs) for files and folders.
RMTShare - The preferred method for creating a file system share (it can also grant permissions).
RUNDLL32 - Run a DLL command (add/remove print connections).
Equivalent PowerShell: Get-CIMinstance win32_share.
Equivalent bash command (Linux): mount - Mount a file system.


 
Copyright © 1999-2024 SS64.com
Some rights reserved