- Home
·
- Miscellaneous
·
- WMI sample showing how to create a share on a remote computer using WMI class Win32_Share
WMI sample showing how to create a share on a remote computer using WMI class Win32_Share
WMI sample showing how to create a share on a remote computer using WMI class Win32_Share
Rate WMI sample showing how to create a share on a remote computer using WMI class Win32_Share
(1(1 Vote))
' This sample creates a new share on a (remote) computer
' Check out http://www.activxperts.com/activmonitor for more samples and
' components
Sub CreateShare( strComputer, strFolder, strShareName )
Dim strObject, objPrintJobSet
Set objWMIShare = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2:Win32_Share")
objWMIShare.Create strFolder,strShareName,0
Set objWMIShare = Nothing
End Sub
' Main
Dim strComputer, strFolder, strShare
Do
strComputer = inputbox( "Please enter the name of a computer in your network (or . for local host)", "Input" )
Loop until strComputer <> ""
Do
strFolder = inputbox( "Please enter the folder you want to share (for example, c:\temp)", "Input" )
Loop until strFolder <> ""
Do
strShare = inputbox( "Please enter the name of the new share(for example, Temp)", "Input" )
Loop until strShare <> ""
CreateShare strComputer, strFolder, strShare
WScript.Echo( vbCrlf & "Ready." & vbCrlf & "Check out http://www.activxperts.com/activmonitor for more samples and components." )
WMI sample showing how to create a share on a remote computer using WMI class Win32_Share Comments
No comments yet — be the first to post one!
Post a Comment