Finding the domain name of the form user

C

CoryP

I have a form that I am checking to see if the user is online or offline
using MachineOnlineState in order to get data from either a remote or local
database. In order to access the remote database, the user not only has to
be online, but they need to be on the same domain as well.

So, in order to find out their DNSDomain, I did a GetObject on winmgmts in a
vbs file and it worked perfectly. However, when I copied that code to the
script.vbs file for the InfoPath form, I get permission errors every time.

I am asking if anyone can provide me with a solution that will work within
an InfoPath form. Or show me how to pass credentials in with the GetObject
of winmgmts.

Sorry if I did a bad job explaining this. I hope you can understand.

-Cory
 
U

Uma Karnati

Hi cory,

I understand your problem..you explained it clearly.

I can't give the complete solution for your problem at now, But I'll give
one reason why you are getting the permission denaied errors in InfoPath.
Generally InfoPath requires "FullTrust" to use any external objects in any
scripting code.
I think you have to implement your VBScript code with combination of the
InfoPath form which has under full trust.

I hope this will help you in one way to solve your problem.
 
C

CoryP

That sounds like the solution. However, someone has brought to my attention
that a form user could be on the domain, but still be unable to access the
remote server. So I may have to rethink this.

Thanks though, "FullTrust" sounds like the answer to my problem.
 
F

funnybroad

Here's what I'm doing with a VBSCRIPT, and it works pretty good with no
"trust" issues:

Set objShell = CreateObject("WScript.Shell")
strUserName = objShell.ExpandEnvironmentStrings("%USERNAME%")
strUserDomain = objShell.ExpandEnvironmentStrings("%USERDOMAIN%")
strComputerName = objShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objShell = Nothing

I have "trust" issues when I then take the contents of the domain and user
name variables and try to do an LDAP query to get more information from
Active Directory.
 
F

funnybroad

p.s.

I just thought of something: I'm not sure if these environment variables
are just something my company sets, or if they're default environment
variables for a Windows XP computer that is the member of a domain.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top