Page 1 of 1

Acces share on a server or workgroup PC

Posted: Thu Mar 02, 2017 2:49 pm
by mrcoollion
I am trying to acces a file on a workgroup PC within my network (as a test)

On Windows I need to be able to:
1) Access a share on a server with a share related userID and password. (\\ServerName\SharedFolderName)
2) After 1 is possible I need to be able to acces this share and copy a SQLite DB to it.
3) If 1 & 2 are successful I need to use that DB in my Stack.

I cannot seem to find the the information on how to achieve this.

I tried

Code: Select all

put tFullDatabaseFileLocation & " /user "&tUserID &" "&tPassword into tFullDBFileLocationAndCredentials
    if there is a file tFullDBFileLocationAndCredentials
    then
        // Do something
    else
       // Do something else
    end if
But no luck..
Any idea's

regards,

MrCoolLion (Paul)

Re: Acces share on a server or workgroup PC

Posted: Thu Mar 02, 2017 6:46 pm
by AxWald
Hi,

Code: Select all

   put "I'm Joe" into myUser
   
   if (Me = paranoid) then
      put "*" into myPass
   else
      put "ThisCouldBeBetter" into myPass
   end if
      
   if (Me = Domainmember) then
      put "theDomainName" & "\" into myDomain
   else
      put empty into myDomain
   end if
   
   get shell("net use X: \\Server\ShareDir /user:" & myDomain & myUser && myPass && "/persistent:no")
   
   get revdb_connect("sqlite", "X:\DBFolder\mydb.sqlite")
This should give you an idea. Hint: If you are paranoid, the system should ask you for your password ;-)

Have fun!

Re: Acces share on a server or workgroup PC

Posted: Fri Mar 03, 2017 12:09 am
by mrcoollion
Thx AxWald,

I have worked with the shell command before and seems to be a good solution for this situation.
---- UPDATE 03-03-2017 ---------
For others who need this. I placed the file-share in-between quotes and it worked. The astrix [*] means that it will get the highest possible free driveletter.
After this I could open the sqlite database and check on it with the file command.

Code: Select all

    put "net use * quote"& tDatabaseFileShare &"quote /user:"& tDomain & tUserID && tPassword && "/persistent:no" into tCommand
    replace "quote" with quote in tCommand
    get shell(tCommand)
    answer "Shell: "&it
----------------------

Regards,

Paul