Windows Scripting. Share Drive

This is a discussion on Windows Scripting. Share Drive within the Windows Programming forums, part of the Platform Specific Boards category; i know how to map a network drive... Code: Set objNetwork = CreateObject("Wscript.Network") objNetwork.MapNetworkDrive "Z:", "\10.0.0.15\d$" is the something like ...

  1. #1
    Registered Abuser Loic's Avatar
    Join Date
    Mar 2007
    Location
    Sydney
    Posts
    115

    Windows Scripting. Share Drive

    i know how to map a network drive...

    Code:
    Set objNetwork = CreateObject("Wscript.Network")
    objNetwork.MapNetworkDrive "Z:", "\\10.0.0.15\d$"
    is the something like that to share a drive?

    Ps: sorry in advance for asking a non c/c++ question on here...


    --EDIT--

    I don’t know what happened here buy half of my thread disappeared... but what I was saying, was I am trying to write a script to share a drive on windows server maybe something like vbscript. Just for an issue I am having with some backups. When I change the drive over the share removes it self. any ideas?
    Last edited by Loic; 01-22-2008 at 05:13 PM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,699
    >> When I change the drive over the share removes it self.
    What do you mean?

    There's a WMI object for creating shares:
    http://msdn2.microsoft.com/en-us/library/aa394594.aspx

    gg

  3. #3
    Registered Abuser Loic's Avatar
    Join Date
    Mar 2007
    Location
    Sydney
    Posts
    115
    Quote Originally Posted by Codeplug View Post
    >> When I change the drive over the share removes it self.
    What do you mean?

    There's a WMI object for creating shares:
    http://msdn2.microsoft.com/en-us/library/aa394594.aspx

    gg
    well every day the drive that is connected has to be replaced and taken of site.

    eg: there is 10 hard drives.
    Monday week 1 is replaced by Monday week 2.
    then the following week Monday week 2 is replaced by Monday week 1...


    EDIT:

    Just had a look at that page you sent me...
    cheers, this script should do the trick.
    Code:
    Const FILE_SHARE = 0
    Const MAXIMUM_CONNECTIONS = 25
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\cimv2")
    Set objNewShare = objWMIService.Get("Win32_Share")
    errReturn = objNewShare.Create _
        ("C:\Finance", "FinanceShare", FILE_SHARE, _
            MAXIMUM_CONNECTIONS, "Public share for the Finance group.")

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Network Programming in C for Windows
    By m.mixon in forum C Programming
    Replies: 7
    Last Post: 06-19-2006, 09:27 PM
  2. Windows Rant followed by installation question
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 06-21-2003, 05:42 PM
  3. Codec Bitrates?
    By gvector1 in forum C# Programming
    Replies: 2
    Last Post: 06-16-2003, 09:39 AM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 10:37 AM
  5. How come this only works in Windows nt/2000?
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 08-30-2002, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21