Jump to content
Sign in to follow this  
thor918

drivemapadd problem number5

Recommended Posts

thor918

The thing is that I can't seem to give a reproducable code that gives away what's wrong, because the code works ok, and sometimes not...

when it don't work it gives error code 5 = Invalid remote share

the script is an UP script of openvpn. the script is executed when openvpn connection is attchived.

The script is excuted by a Run("script/AutoIt3 script/up.au3")

When I excute the code in the IDE, it seems to work every time....

$computer   = "10.8.0.1"
$timeout     = 250
$maxlogintry = 5

$count = 0
;Check if it is possible to connect to server
While $count < 70; ca 7 sekunders timeout
    $pcFound = Ping($computer, $timeout)
    if $pcFound then ExitLoop
        Sleep(100)
        $count += 1
WEnd

If $pcFound Then;Connection
    ;Mapping av nettverksstasjoner
        $username = 'ole'
        $password = 'Password2'
        $domain = 'seln.local'

        $Driveletter = DriveMapAdd("*", "\\win2003\felles", 0, $domain & "\" & $username, $password)
        MsgBox(4096, "Test", @error)

Else
    MsgBox (0, "Loginscript", "timeout. no contact with server")
EndIf

Share this post


Link to post
Share on other sites
evilertoaster

$Driveletter = DriveMapAdd("*", "\\win2003\felles", 0, $domain & "\" & $username, $password)

Im guessing it breaks on that line?

If so it may be exactly what the error is saying...maybe the machine you are trying to map to is off or unreachable from your network.

Share this post


Link to post
Share on other sites
thor918

yes correct the error is cast when I map a nettworkdrive.

but I find it strange that sometimes it work, and sometimes it does not...

Edited by thor918

Share this post


Link to post
Share on other sites
thor918

$Driveletter = DriveMapAdd("*", "\\win2003\felles", 0, $domain & "\" & $username, $password)

Im guessing it breaks on that line?

If so it may be exactly what the error is saying...maybe the machine you are trying to map to is off or unreachable from your network.

Hmm I guess your right,

seems my netbios name setup isn't as solid as I was expecting.

changed \\win2003 to my \\ip

and no error 5.

strangly win2003 name works everytime I ping

Edited by thor918

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.