Jump to content

Creating a share


ChrisL
 Share

Recommended Posts

Does anybody know how to create a share on Windows XP?

I don't think Net Share is going to work because this only enables a read only share.

Is there a COM object or something which you can create a share with read/write access for a specific user?

Thanks

Link to comment
Share on other sites

I found this but I'm not sure exactly how to convert it, could someone help please

Const FILE_SHARE = 0

Const MAXIMUM_CONNECTIONS = 25

strComputer = "atl-ws-01"

Set objWMIService = GetObject _

("winmgmts:\\" & strComputer & "\root\cimv2")

Set objNewShare = objWMIService.Get("Win32_Share")

errReturn = objNewShare.Create _

("C:\Public", "PublicShare", FILE_SHARE, _

MAXIMUM_CONNECTIONS, "Public share for Fabrikam employees.")

Link to comment
Share on other sites

Not tested:

Const $FILE_SHARE = 0
Const $MAXIMUM_CONNECTIONS = 25

$strComputer = "atl-ws-01"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

$objNewShare = $objWMIService.Get("Win32_Share")

$errReturn = $objNewShare.Create("C:\Public", "PublicShare", $FILE_SHARE, $MAXIMUM_CONNECTIONS, "Public share for Fabrikam employees.")

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Not tested:

Const $FILE_SHARE = 0
Const $MAXIMUM_CONNECTIONS = 25

$strComputer = "atl-ws-01"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

$objNewShare = $objWMIService.Get("Win32_Share")

$errReturn = $objNewShare.Create("C:\Public", "PublicShare", $FILE_SHARE, $MAXIMUM_CONNECTIONS, "Public share for Fabrikam employees.")

Yes that works great thanks, I was trying to do it with objCreate and not ObjGet like what you have done.

Thanks again

Link to comment
Share on other sites

  • 9 years later...
On 06.09.2006 at 6:34 PM, GaryFrost said:

Not tested:

 

 

Const $FILE_SHARE = 0
Const $MAXIMUM_CONNECTIONS = 25

$strComputer = "atl-ws-01"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

$objNewShare = $objWMIService.Get("Win32_Share")

$errReturn = $objNewShare.Create("C:\Public", "PublicShare", $FILE_SHARE, $MAXIMUM_CONNECTIONS, "Public share for Fabrikam employees.")

How to access from other computers, read, write and how we can give permissions to?

Link to comment
Share on other sites

  • Moderators

@Burak did you not notice that this thread is almost 10 years old? Please don't resurrect old posts, as the language has grown in 10 years and what worked then may no longer be the best method to solve your problem. You are much better served by creating a new thread, explaining in detail what you are trying to accomplish, along with what you have tried on your own already to show you've put some effort in.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...