Jump to content
Darien

_Net_Share_ShareCheck does not work

Recommended Posts

Darien
Posted (edited)

Hello,

 

The command below always returns -1, but I can usually map this folder to Windows as \\computerX\folderX.

 

_Net_Share_ShareCheck ( "computerX" , "folderX" )

 

What could it be?

Edited by Darien

Share this post


Link to post
Share on other sites
big_daddy

Try _Net_Share_ShareEnum and see what you get back.

Share this post


Link to post
Share on other sites
Darien

The _Net_Share_ShareEnum shows the shared folder.

Share this post


Link to post
Share on other sites
big_daddy

_Net_Share_ShareCheck is looking for a local path instead of a share name. Try this:

#include <MsgBoxConstants.au3>
#include <NetShare.au3>

If CheckShareByName(@ComputerName, "AutoIt Share") = -1 Then
    MsgBox(0, "", "Share does not exist")
Else
    MsgBox(0, "", "Share exists!")
EndIf

Func CheckShareByName($sServer, $sShareName)
    Local $aReturn = _Net_Share_ShareGetInfo($sServer, $sShareName)
    If @error Then Return SetError(@error, 0, -1)
    Return _Net_Share_ShareCheck($sServer, $aReturn[6])
EndFunc

 

Share this post


Link to post
Share on other sites
Darien

Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×