Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if local account exists

Status
Not open for further replies.

MrChopper

Programmer
Aug 11, 2004
20
US
Is there any way I can do this easily? I know how to create and remove accounts, I was wondering if there was some way to verify one exists, too..
 
MrChopper,

You know an account, hence you have its info at hand. You want to verifiy if it exists. To do it, you bind to it simplest using WinNT: provider. If it error out? it does not exist.
[tt]
on error resume next
set ouser=getobject("WinNT://" & scomputer & "/" & username & ",user")
if err.number<>0 then
wscript.echo "The user account does not exist."
err.clear
'do something necessary
end if
on error goto 0
[/tt]
regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top