Jump to content
Sign in to follow this  

Accessing a passworded network share

Recommended Posts

We have just had a small raid server installed at work to protect customer files and some of our stuff as well

I have a tool which retrieves customer backups from the network back to the machines after format etc

This is how i access at min, i test for a file on the server then they choose a folder to retrieve

If FileExists("\\TSSERV\BackupShare\test.dll") Then
                    $sSource = FileSelectFolder("Choose A Backup.", "\\TSSERV\BackupShare", 2)
                    If @error Then ; If error then add warning
                        Switch @error
                            Case 1
                                MsgBox($MB_ICONWARNING, "Selection Error", "User Cancelled Operation", 4)

Then the program uses robocopy to copy the files across and to avoid UNC problems.

The machine being used to access the server has never connected to before.

Now the issue is this is a proper server now with username and password and the first bit should trigger the popup where we have to put in the username/password, but it doesnt seem to then we have to try and open it by network and trigger the popup etc

Is there a way to add them automatically?

Its only used on our network and only staff use it so user and pass isnt a prob

Edited by Chimaera

Share this post

Link to post
Share on other sites

Managed to get somewhere on this like this

Global $netsh1 = ShellExecuteWait("netsh.exe", 'advfirewall firewall set rule group="Network Discovery" new enable=Yes', "", "", @SW_HIDE)
    Global $netsh2 = ShellExecuteWait("netsh.exe", 'advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes', "", "", @SW_HIDE)
    Global $netuse = Run(@ComSpec & " /c " & "net use p: \\TSSERV\BackupShare /user:username password", "",@SW_SHOW)

Had to switch on discovery etc

Then add the access command

Share this post

Link to post
Share on other sites

Still getting a problem with this

When i run this

$netuse = Run(@ComSpec & " /c " & "net use p: \\TSSERV\BackupShare /user:username password /persistent:yes", "", @SW_SHOW)

It creates the share correctly but after a reboot the share has a cross against it and you cant login with inputting the password

If i map the share manually it works correctly

Any ideas?

Share this post

Link to post
Share on other sites

I've had a similar problem once where the remote system was not using active directory to authenticate users and had its own user management system.

I figured out that only way to get it to work was setting the username/password on both the AD user and the user to log onto the target system to exactly the same.

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  

  • Create New...