We help IT Professionals succeed at work.

Simple vbs Question: Modifing a script to prompt for user input.

Joseph Moody
Joseph Moody asked
on
260 Views
Last Modified: 2012-05-05
This is a very simple question. Is it possible to modify the script below to prompt for a username and then disable that username? I have absolutely zero experience in vbs so I do not even know where to begin. Any help would be great!
Const ADS_UF_ACCOUNTDISABLE = 2
 
Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
intUAC = objUser.Get("userAccountControl")
 
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Paul TozerAzure and M365 Consultant
CERTIFIED EXPERT

Commented:
try
dim fname
fname=InputBox("Enter your name:")
Const ADS_UF_ACCOUNTDISABLE = 2
 
Set objUser = GetObject _
("LDAP://cn=" & fname & ",ou=management,dc=fabrikam,dc=com")
intUAC = objUser.Get("userAccountControl")
 
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo

Open in new window

Joseph MoodyBlogger and wearer of all hats.
CERTIFIED EXPERT

Author

Commented:
That worked perfect! And now I have a good example for any other scripts that I made need to do this to in the future.

Thanks again!
CERTIFIED EXPERT
Top Expert 2007

Commented:
Happy to help - thanx for the grade! :^)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.