ChrisL

Creating a share

7 posts in this topic

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

Share this post


Link to post
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.")

Share this post


Link to post
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.

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#6 ·  Posted

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?

Share this post


Link to post
Share on other sites

#7 ·  Posted

@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.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.