Change a shared folder path?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Rick Voland (Voland_at_discussions.microsoft.com)
Date: 02/21/05


Date: Sun, 20 Feb 2005 17:55:08 -0800

I have about 300 shared folders that I need to have the path changed because
we the folders are getting moved to another drive. I can list and create
shares, but cannot figure out how to change the path of an existing share. I
get an error when I try to change it. Can this be done with VBScript or is
there another tool I can use?

Please help,

Rick
==================================
Creating share:

Set FservObj = GetObject("WinNT://ComputerName/lanmanserver")

set newshare = FservObj.create("fileshare","test")
newshare.path = "C:\temp"
newshare.setinfo
Set newshare = nothing

=====================================
Listing Share info:

Set FS = GetObject("WinNT://stretch2400/LanmanServer/Test1")
    Wscript.Echo vbtab & fs.Path
    Wscript.Echo vbtab & fs.MaxUserCount
    Wscript.Echo vbtab & fs.AdsPath
    Wscript.Echo vbtab & fs.Path
    Wscript.Echo vbtab & fs.Class
    Wscript.Echo vbtab & fs.CurrentUserCount
    Wscript.Echo vbtab & fs.description
    Wscript.Echo vbtab & fs.GUID
    Wscript.Echo vbtab & fs.HostComputer
    Wscript.Echo vbtab & fs.Parent
    Wscript.Echo vbtab & fs.Schema
' *** This is where I get the error.
' FS.Path = "C:\Scripts"
' FS.SetInfo
' Wscript.Echo vbtab & fs.Path