Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

VBScript - Automatically pass Credentials


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 216 posts
I have a script that connects to an Access Database. I need to use the Access Database to read and write the data, but when the script runs I get the login prompt, meaning I have to run this job manually. Doesn anyone have any idea how I might put a username and password through to help automate this script?

I've done somethign similar before with Web Directory Security, but I'm not sure how to get my vbscript working. Any help would be greatly appreciated.


DSN="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=L:\Data.mdb;"
Set con = CreateObject("ADODB.Connection")
con.Open(dsn)

'-----------------------------------This worked in Web, but isn't working here

struserName = "USERNAME"
strPassWord = "PASSWORD"
strURL="SHAREPOINT ADDRESS"

Dim objXMLHTTP
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Call objXMLHTTP.Open("Get", strURL, False, struserName, strPassWord)
Call objXMLHTTP.Send()

'-----------------------------------

strSQL="SELECT * FROM [Data]"
Set rstuid = CreateObject("ADODB.Recordset")
rstuid.Open strSQL, con, adOpenStatic, adLockReadOnly

rstuid.movenext

My goal is for it to be able to run without someone having to do it manually and enter in the username and password.

Thanks!
  • 0

Advertisements


#2
devper94

devper94

    Member

  • Member
  • PipPipPip
  • 817 posts
Append to the connection string
"User ID=USERNAME_HERE;Password=PASSWORD_HERE;"
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP