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. Web Development
  3. ASP.NET
  4. Using WMI win32_share in asp.net page not working on IIS6?

Using WMI win32_share in asp.net page not working on IIS6?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiosysadminwindows-admin
2 Posts 1 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.
  • L Offline
    L Offline
    leeoze 0
    wrote on last edited by
    #1

    hi, I'm trying to create a folder sharing using WMI win32_share on an ASP.NET c# page. while running it using the visual studio 2008 it works great. But after I publish it to the IIS and run the WebPage nothing happends?! it's seems like the page was loaded fine but checking the folder I see no share was created. Any ideas? I'm using .NET 3.5, visual studio 2008, c# webapplication. IIS 6 server. here is the code

    string shareName = "Test";
    string CUDir = @"D:\Test";
    ManagementClass managementClass = new ManagementClass("Win32_Share");

            // Create ManagementBaseObjects for in and out parameters
            ManagementBaseObject inParams = managementClass.GetMethodParameters("Create");
            ManagementBaseObject outParams;
            
            // Set the input parameters
            inParams\["Description"\] = "";
            inParams\["Name"\] = shareName;
            inParams\["Path"\] = CUDir;
            inParams\["Type"\] = 0x0; // Disk Drive
            // Invoke the method on the ManagementClass object
            outParams = managementClass.InvokeMethod("Create", inParams, null);
    

    tnx

    modified on Tuesday, January 27, 2009 4:33 AM

    L 1 Reply Last reply
    0
    • L leeoze 0

      hi, I'm trying to create a folder sharing using WMI win32_share on an ASP.NET c# page. while running it using the visual studio 2008 it works great. But after I publish it to the IIS and run the WebPage nothing happends?! it's seems like the page was loaded fine but checking the folder I see no share was created. Any ideas? I'm using .NET 3.5, visual studio 2008, c# webapplication. IIS 6 server. here is the code

      string shareName = "Test";
      string CUDir = @"D:\Test";
      ManagementClass managementClass = new ManagementClass("Win32_Share");

              // Create ManagementBaseObjects for in and out parameters
              ManagementBaseObject inParams = managementClass.GetMethodParameters("Create");
              ManagementBaseObject outParams;
              
              // Set the input parameters
              inParams\["Description"\] = "";
              inParams\["Name"\] = shareName;
              inParams\["Path"\] = CUDir;
              inParams\["Type"\] = 0x0; // Disk Drive
              // Invoke the method on the ManagementClass object
              outParams = managementClass.InvokeMethod("Create", inParams, null);
      

      tnx

      modified on Tuesday, January 27, 2009 4:33 AM

      L Offline
      L Offline
      leeoze 0
      wrote on last edited by
      #2

      The problem was on the IIS application pool. in order for me to use Win32_share I need to setup the predefined Identity of the Application Pool to Local System. otherwise I have no premissions to use WMI. I can also set the Configurable to a user with the right premissions to do the same. To access the Identity you need to open the IIS Manager. Colpase the Apllication pools and either create a new pool to be used or edit the deafult by right click and Properties. Go to the Identity tab and choose your wish. Also do not forget to go to under Web Sites and on your selected website/virtual directory properties to set under the Application settings the Apllication pool to the one with the new premissions.

      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