Creating a Network Share
Recursos.vbs
Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = ""
OLD = ""strComputer = "Nombre_Servidor"
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")Set objNewShare = objWMIService.Get("Win32_Share")
errReturn = objNewShare.Create ("RutaFisica", "NombreRecurso", FILE_SHARE )
Deleting a Network Share
strComputer = "."
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery _
("Select * from Win32_Share Where Name = 'FinanceShare'")
For Each objShare in colShares
objShare.Delete
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")
For each objShare in colShares
Wscript.Echo "AllowMaximum: " & vbTab & objShare.AllowMaximum
Wscript.Echo "Caption: " & vbTab & objShare.Caption
Wscript.Echo "MaximumAllowed: " & vbTab & objShare.MaximumAllowed
Wscript.Echo "Name: " & vbTab & objShare.Name
Wscript.Echo "Path: " & vbTab & objShare.Path
Wscript.Echo "Type: " & vbTab & objShare.Type
Next
Fuente: http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/filesfolders/sharedfolders/
Comentarios