Scipt execution if computer is part of my domain

Posted on 2005-04-17
Last Modified: 2010-05-18
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.

Question by:pammann
    LVL 95

    Expert Comment

    by:Lee W, MVP
    See if this works:

    IF "%userdomain%" == "DomainToRunAuditsOn" AuditProgram.exe

    Author Comment

    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?
    LVL 95

    Accepted Solution

    You could change the login scripts to be OU based, only applying them to computers in your domain.
    LVL 30

    Expert Comment

    by:Wayne Barron
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now