Mark Minasi's Reader Forum
Mark Minasi's Reader Forum
Home | Profile | Register | Active Topics | Active Polls | Members | Search | FAQ | Minasi Forum RSS Feed
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 HALP! Questions on Windows and Windows Server
 Active Directory
 single-use AD account
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mazaffar
Seasoned But Casual Onlooker

83 Posts
Status: offline

Posted - 06/14/2012 :  03:38:39 AM  Show Profile  Reply with Quote
Hello,
is there a tool that will generate an alpha numeric string that can be used to create an AD account automatically?

For eg, I imagine setting up a task that will run the tool, output the string to a file and run another task that will create an account in AD using that string as the u/n and p/w.

Thanks,
Mazaffar.

Pieter
Old Timer

Belgium
522 Posts
Status: offline

Posted - 06/14/2012 :  03:45:06 AM  Show Profile  Reply with Quote
Probably the most old fashion way is this :
net USER test%random% password /ADD /DOMAIN

Run it as a domain Administrator.
The %random% variabel will be translated to a random generated number.


Pieter Demeulemeester
Go to Top of Page

mazaffar
Seasoned But Casual Onlooker

83 Posts
Status: offline

Posted - 06/14/2012 :  05:12:30 AM  Show Profile  Reply with Quote
quote:
Originally posted by Pieter
[Run it as a domain Administrator.
The %random% variabel will be translated to a random generated number.




Is it possible to find out what the password is so the user can be informed?
Thanks.
Go to Top of Page

Pieter
Old Timer

Belgium
522 Posts
Status: offline

Posted - 06/14/2012 :  05:43:23 AM  Show Profile  Reply with Quote
>> find out.
No.

Since you create the user yourself and give it a PW yourself, you know it ;-)

example:
net USER test%random% P@ssw0rd /ADD /DOMAIN
=> password is P@ssw0rd for all users

net USER test%random% PW%random% /ADD /DOMAIN
=> password is PWnnnn where nnnn is NOT the same random number as the user. You have to verify the output from 'net use' to know the PW.





Pieter Demeulemeester
Go to Top of Page

mazaffar
Seasoned But Casual Onlooker

83 Posts
Status: offline

Posted - 06/14/2012 :  08:58:05 AM  Show Profile  Reply with Quote
net USER test%random% PW%random% /ADD /DOMAIN

I tried this, specifying a username. The account was created with a random password. I don't know how to output the password to a file.
Is it possible to autmatically email the password to the user?

Mazaffar
Go to Top of Page

Pieter
Old Timer

Belgium
522 Posts
Status: offline

Posted - 06/14/2012 :  09:10:46 AM  Show Profile  Reply with Quote
>>how to output the password to a fileunfortunately the 'net use' command doesn't show it in his output.

You could make a script :
set $USER=test%random%
Set $PW=PW%random%
echo Creating %$USER% with password %$PW%
net USER test%$USER% PW%$PW% /ADD /DOMAIN


Save the above lines with CMD as extension and run it (elevated prompt on a DC !).

If you want the usernames and password logged in a file, add this
echo %$USER%; %$PW% >> file.log


>> Is it possible to automatically email the password to the user?
It is possible, but it will take some work. I always use blat.exe in my script to send a mail.


PS: I didn't test the above script.


Pieter Demeulemeester
Go to Top of Page

mazaffar
Seasoned But Casual Onlooker

83 Posts
Status: offline

Posted - 06/14/2012 :  10:11:17 AM  Show Profile  Reply with Quote
i get unknown error code 2 when trying to open file filename.

The file is in the same directory as the blat.exe. I have done the -install bit and told it the exchange server hostname.

Could i have an example please?
Mazaffar
Go to Top of Page

Pieter
Old Timer

Belgium
522 Posts
Status: offline

Posted - 06/14/2012 :  10:29:06 AM  Show Profile  Reply with Quote
blat.exe "C:\file.txt" -server MySmtpServer -f "%COMPUTERNAME%" -to MyEmail@domain.com -subject "This is the subject" -attach "C:\attachment.txt" -ti 10 -try 3

I never use the -install switch

Pieter Demeulemeester
Go to Top of Page

mazaffar
Seasoned But Casual Onlooker

83 Posts
Status: offline

Posted - 06/15/2012 :  03:10:36 AM  Show Profile  Reply with Quote
Thanks for your help so far.

It says:
***Error*** The SMTP does not like sender name
***Error*** Have you set your mail address correctly.

When I ommit the -f switch blat is unable to the registry key. I think it wants me to use the -install switch but i would rather not. Is the -f switch for the computername from where you are running the blat?

Thanks,
Mazaffar
Go to Top of Page

Pieter
Old Timer

Belgium
522 Posts
Status: offline

Posted - 06/15/2012 :  03:16:30 AM  Show Profile  Reply with Quote
>> Is the -f switch for the computername from where you are running the blat?
Yes.

Things to consider:
- anti-virus that blocks SMTP (McAfee does by default)
- your exchange must accept your client to send smtp mail
- firewall
...

Pieter Demeulemeester
Go to Top of Page

mazaffar
Seasoned But Casual Onlooker

83 Posts
Status: offline

Posted - 06/15/2012 :  06:57:49 AM  Show Profile  Reply with Quote
quote:
Originally posted by Pieter

>> Is the -f switch for the computername from where you are running the blat?
Yes.

Things to consider:
- anti-virus that blocks SMTP (McAfee does by default)
- your exchange must accept your client to send smtp mail
- firewall
...



i created a new receive connector but it still said it does not like sender name.
Mazaffar
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Mark Minasi's Reader Forum © 2002-2011 Mark Minasi Go To Top Of Page
This page was generated in 0.16 seconds. Snitz Forums 2000