home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC/CD Gamer UK 45
/
PCGAMER45.bin
/
netware
/
msie4pp
/
wsh.cab
/
adduser.vbs
next >
Wrap
Text File
|
1996-10-21
|
2KB
|
67 lines
' Windows Script Host Sample Script
'
' ------------------------------------------------------------------------
' Copyright (C) 1996 Microsoft Corporation
'
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Microsoft has no warranty,
' obligations or liability for any Sample Application Files.
' ------------------------------------------------------------------------
'
' VBS Script to create a user
'
' Syntax: adduser.vbs /C=<country>/O=<o>/OU=<ou> accountname firstname lastname password
'
' Example adduser.vbs /C=US/O=ArcadiaBay/OU=Americas PaulCezanne Paul Cezanne secret
'
dim con
dim oArgs
dim newuser
dim Style
dim Title
dim CRLF
CRLF = Chr(13) & Chr(10)
set oArgs = WScript.Arguments
If oArgs.Count < 5 Then
Style = vbOKOnly ' Define buttons.
Title = "Usage" ' Define title.
Response = MsgBox("Adds a user via OLE DS" & CRLF & CRLF & _
"Usage:" & CRLF & CRLF & _
" adduser.vbs /C=<country>/O=<o>/OU=<ou> accountname firstname lastname password " & CRLF & CRLF & _
"Example:" & CRLF & CRLF & _
" adduser.vbs /C=US/O=ArcadiaBay/OU=Americas PaulCezanne Paul Cezanne secret" & CRLF, _
Style, Title)
'stop script
WScript.Quit(1)
End If
set oArgs = wscript.arguments
set con = wscript.GetObject("LDAP:/"+oArgs.item(0))
'
' make a new user
'
set newuser = con.create("user","CN="+oArgs.item(1))
newuser.put "cn",oArgs.item(1)
newuser.put "description","created from VBS!"
' set the properties of the new user
newuser.Put "givenName",oArgs.item(2)
newuser.Put "sn", oArgs.item(3)
newuser.Put "sAMAccountName", oArgs.item(1)
newuser.Put "User-Account-Control",16 'Enable the account
' ...and update the DS
newuser.setinfo
newuser.setpassword(oArgs.item(4))
wscript.echo newuser.name+" created."
set newuser=nothing
'
' Done
'