Scipt execution if computer is part of my domain

I have a pretty basic logon script that executes when a user logs onto the domain.  It is a simple .bat file to map some drives.  But at the end of the script I call a computer audit program to inventory installed software, and hardware.  My problem is that we have a VPN and I will occasionally have a user sit at a machine in another child domain and log onto my domain from this other domain machine.  Works great when people are on travle to our other offices.  But what happens is my audit program ends up auditing this other domain computer.

What I really need is a conditional statement that lets the audit run if the computer is ONLY a member of my domain.  Is this possible?  I don't know the correct syntax or if it can be done in a simple .bat script.  i would think it would be like:

if COMPUTER is Member of Domain X
  then run Audit
end if

Maybe VB?  thanks.

Who is Participating?
Lee W, MVPTechnology and Business Process AdvisorCommented:
You could change the login scripts to be OU based, only applying them to computers in your domain.
Lee W, MVPTechnology and Business Process AdvisorCommented:
See if this works:

IF "%userdomain%" == "DomainToRunAuditsOn" AuditProgram.exe
pammannAuthor Commented:
Well the user is always part of my domain, it is the workstation they logon on from is sometimes a member of another 2K child domain.  is there a test for computer domain membership?  Is member Domain Computers in Domain X?
Wayne BarronAuthor, Web DeveloperCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
[Accept: leew]

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.