A Quick Tip To Create Shared Folders Remotely

by [Published on 7 Dec. 2010 / Last Updated on 31 Oct. 2009]

This article explains how you can create shared folders remotely on remote computers.

You can use Resource Kit tool called; rmtshare.exe to create shared folders remotely. You need to use three commands as mentioned below:

  • MD command to create a directory on the remote computer
  • Rmtshare.exe command to share the directory
  • Xcacls.vbs to assign permissions on the shared folder.

This is how you do it. You need to create a folder called; Incoming on C:\ drive on all the client computers. This folder is used by the Antivirus Server to store the updates and client version of Antivirus, running on client computers, pulls the updates from Incoming directory. You have found that the Incoming folder is no longer shared. You can create a small script to share this folder on all the computers in your environment:

Steps:

  • Create a text file: CompList.TXT
  • Put all the client computer names in this file
  • Next, put the following commands in a file and save it as Share.CMD
  • ***START HERE*** 
  • @ Echo Off
  • setlocal enabledelayedexpansion
  • FOR /F "Tokens=*" %%L IN (CompList.TXT) DO (
  •    SET CompName=
  •    SET CompName=%%L
  •    MD \\!CompName!\C$\Incoming
  •    Rmtshare.exe \\!CompName!\Incoming$ = C:\Incoming
  •    Xcacls.VBS \\!CompName!\Incoming$ "DomainName.Com/Domain Admins":F
  • )
  • ***END HERE***

Now, run the Share.CMD from a computer which has access to all the computers mentioned in the CompList.TXT. The script runs against each computers mentioned in the CompList.TXT and execute the commands to create, share and assign the Full Control permissions to Domain Admins Security Group to share Incoming$ on all the computers.

 

Featured Links