Jump to content

_Net_Share_ShareCheck does not work


Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

_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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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