Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help Me i use Win32_Share Class

Help Me i use Win32_Share Class

Scheduled Pinned Locked Moved Visual Basic
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BatUlzii
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • B BatUlzii

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups