Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



Sign in to follow this  
engert100

Batch file request

Recommended Posts

engert100    0

Hi,

does anyone know if it's possible to create a batch file to acomplish the following.

1. Check if machine is joined to domain.

2a. If it is joined to the domain create a new user account.

2b. If it's not joined to the domain create a different user account.

I am clear in NET USE command and how to add/delete users.

What i'm not clear on, is how to check if a machine is joined to the domain using a batch file.

Any ideas are appreciated.

Thanks.

Share this post


Link to post
Share on other sites

I am not sure if this works 100% of the time, but I have used this in the past:

if %userdomain% EQU %computername% (
echo Not a member of a domain.
) else (
echo Member of %userdomain%
)

I have noticed that when a system is not a member of a domain, both

the userdomain and computername environment variables are the same.

Only tested under XP.

Share this post


Link to post
Share on other sites
engert100    0

I have one more question and if this works i'll be all set.

Is there an option in Winnt.sif where you can give the user a choice: Do you want to join this machine to the domain or to a workgoup?

If it can't be done through winnt.sif, is there any other options to make this possible.

Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×