You can access Windows Management Instrumention (WMI) by using WMIC. Although you can share an existing folder, you cannot set the permissions on the share directly from WMIC.
To create a share on a remote computer by using WMIC:
- At a command prompt, type wmic, and then press ENTER.
- Type /node:computer name where computer nameis the name of the target computer. If you want to pass administrator credentials, type /user:"domain\username", to receive a prompt for a password.
- Type the following line where
c:\test is the path to the folder that you want to share:share call create "", "this is the comments section", "maximum number of connections", "this is the share name", "", "C:\test", 0