Help Me i use Win32_Share Class
-
Const FILE_SHARE = 0 Const MAXIMUM_CONNECTIONS = 25 Dim strComputer As String = "." Dim objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Dim objNewShare = objWMIService.Get("Win32_Share") Dim errReturn = objNewShare.Create _ ("C:\Temp", "Temp", FILE_SHARE, _ MAXIMUM_CONNECTIONS, "MyFolder") i doubleClick temp folder Remote Computer return error access denied on file help me
-
Const FILE_SHARE = 0 Const MAXIMUM_CONNECTIONS = 25 Dim strComputer As String = "." Dim objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Dim objNewShare = objWMIService.Get("Win32_Share") Dim errReturn = objNewShare.Create _ ("C:\Temp", "Temp", FILE_SHARE, _ MAXIMUM_CONNECTIONS, "MyFolder") i doubleClick temp folder Remote Computer return error access denied on file help me
You might want to see if that folder actually got shared on the remote machine. Your code does get a return value from the
objNewShare.Create
method, but it ignores the result. So, you have no way of knowing if the sahre was actually created or not, or why it failed. Also, your code creates the share, but it never sets up any permissions for any groups or users on that share.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007