VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



WMI sample showing how to create a share on a remote computer using WMI class Win32_Share

by Bart Jonkman (20 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 19th February 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



' 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." )

Download this snippet    Add to My Saved Code

WMI sample showing how to create a share on a remote computer using WMI class Win32_Share Comments

No comments have been posted about WMI sample showing how to create a share on a remote computer using WMI class Win32_Share. Why not be the first to post a comment about WMI sample showing how to create a share on a remote computer using WMI class Win32_Share.

Post your comment

Subject:
Message:
0/1000 characters