Mark
I have a script that creates new user accounts but before it does so it searches through 7 containers to make sure that the user name is not already in use, up until now the user just sat there unaware of what was going on but as you can see in the following excerpt I have used the progress bar to let the user know that something is actually being done:
firstname=inputbox("Type the users first name")
if firstname =""then
wscript.echo "You didn't enter a recognised name"
wscript.quit
end if
lastname1=inputbox("Type the users surname")
if lastname1 =""then
wscript.echo "You didn't enter a recognised surname"
wscript.quit
end if
lastname= UCase(lastname1)
initial = LCase(Left(firstName, 1))
initial2 = LCase(Left(firstName, 2))
username1 = LCase(left(lastName,6))
username = username1 & initial
bothName = firstName & " " & lastName
strdisplayname = lastname & " " & firstname & " -my company domain"
strdisplayname1 = lastname & ", " & firstname & " -my company domain"
set objExplorer = createobject("internetexplorer.application")
objExplorer.navigate2 "about:blank" : objExplorer.width = 350 : objExplorer.height = 120 : objExplorer.toolbar = false : objExplorer.menubar = false : objExplorer.statusbar = false : objExplorer.visible = True
objExplorer.document.write "<font color=green>"
objExplorer.document.write "<MARQUEE WIDTH=100% BEHAVIOR=ALTERNATE>Creating user account!</MARQUEE><br>"
objExplorer.document.title = "Please be patient.... "
objExplorer.document.write "<font color=red>"
dim strnames(7)
strnames(0)="OU= Site1 ,OU=XP Users,OU=City1,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(1)="OU= Site4,OU=XP Users,OU=City1,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(2)="OU= Site3,OU=XP Users,OU=City1,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(3)="OU= Site2,OU=XP Users,OU=City1,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(4)="OU= XP Users,OU=City1,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(5)="OU= Users,OU=City1,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(6)="OU= XP Users,OU=City5,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
strnames(7)="OU= Users,OU=City5,OU=Sites,DC=domain,DC=intra,DC=my company,DC=com"
for i= 0 to 7
Set objDomain = GetObject("LDAP://" & strnames(i))
For Each objUser In objDomain
If UCase(objUser.sAMAccountName) = UCase(username) Then
initial = LCase(Left(firstName, 2))
username1 = LCase(left(lastName,6))
username = username1 & initial
Exit For
End If
Next
For n = 1 to 10
objExplorer.document.write "|"
wscript.sleep 10
Next
next
set objParent = GetObject("LDAP://" & strldap)
set objUser = objParent.Create("user", "cn=" & strdisplayname)
objUser.Put "sAMAccountName", "" & username
objUser.Put "userPrincipalName", "" & username & "@domain.intra.my company.com"
objUser.Put "givenName", "" & firstname
objUser.Put "sn", "" & lastname1
objUser.Put "displayName", "" & strdisplayname1
objuser.Put "physicalDeliveryOfficeName", "" & stroffice
objuser.Put "Description" ,"New user: " & Date
objuser.Put "scriptPath", "pilot.syn"
objUser.TerminalServicesProfilePath = "\\" & strfshare & "\profiles.$\" & username & "\terminal"
objUser.mail = firstname & "." & lastname1 & "@my company.com"
objUser.SetInfo
objUser.SetPassword "password"
objUser.AccountDisabled = TRUE
objuser.setinfo
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 240
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.document.write "*-*-*-*-*-*New XP User script*-*-*-*-*-*<p>Account created as: <font color=green>" & username &_
"</font><br>Terminal Services Path:<br><font color=green> " & "\\" & strfshare & "\profiles.$\" & username &_
"\terminal </font><br>Login Script:<font color=green> pilot.syn</font><br>Building: <font color=green>"& strbuild &_
"</font><br>Full Username: <font color=green>" & strdisplayname1 &"</font>"
objExplorer.document.title = "User has now been created..."
wscript.sleep 10000
objexplorer.Quit
etc........