Create a Shared Folder

Creates a file share for an existing folder.

 
 
 
 
 
(0)
Add to favorites
Storage
8/10/2009
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Script to share folder in multiple servers.
    1 Posts | Last post October 14, 2009
    • Hi Scripter,  I´m Facundo from Argentina, before any thing, thanks for your article of "Running WMI Scripts Against Multiple Computers"  i wrote a script based on the article and the script run good and finished whitout any problem but i have a problem trying to run my script in multiple servers.
      
      When i run my script in one server the script ran good and finished do in the task of create the share, but when i put more servers in the input_file computers.txt the script fail. The error that throw is "that the remote computer is no avaible, etc."
      
      This is my script. what is the function or the line wrong that not permit that the script can run in multiple servers? Please help me i don't know what is the problem and i need run this script in 400 servers.
      
      Thanks a lot for read this mail, Sorry for my horrible English
      
      SCRIPT to share Folders:
      
      INPUT_FILE_NAME = "C:\temp\Computers.txt"
      Const FILE_SHARE = 0 
      Const MAXIMUM_CONNECTIONS = 25 
      Const FOR_READING = 1
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
      strComputers = objFile.ReadAll
      objFile.Close
      arrComputers = Split(strComputers, vbCrLf)
      For Each strComputer In arrComputers
      Set objWMIService = GetObject("winmgmts:" _
          & "{impersonationLevel=impersonate}!\\" & strComputers & "\root\cimv2")
      Set objNewShare = objWMIService.Get("Win32_Share")
      errReturn = objNewShare.Create _
          ("C:\tas", "TAS", FILE_SHARE, _
              MAXIMUM_CONNECTIONS, "Public share for the Finance group.")
      Wscript.Echo errReturn
      next