'' Settings
(here replaced by fictitious data)
SetVar CustomerOU, Acme
SetVar CustomerInit, Acme
SetVar MailAdr, xxx@acme.com
SetVar Smtpserver, 192.112.11.2
'' Show menu
:Restart
SetVar Selection,[Menu Self-Service,User|Create
new user,Trashcan|Delete user,Connected|Change user password,_
Network|Unlock user
account,documents|Change user info,information|Show user groups,_
Add user to
group,process|Remove user from group,Stop|Exit]
If [Var Selection]=Exit Then Exit
If Not VarIsEmpty Selection Then Goto [Var Selection]
Exit
/*******************
CREATE USER ACCOUNT IN THE CUSTOMERS OU *******************/
:Create new user
MultiInput Create new user,UserName|User name (Initials),
FirstName|First name,LastName|Last name,Title,_
PhoneNo|PhoneNo,Password|Password (Min 6 chars)
If Not [Var UserName]=[Blank] Then
SetVar SelectedUser,[ListMenu Select template user,
[GroupUsers [Var CustomerInit]-template]]
SetVar SelectedOU,[ListMenu Select location,[OUsInOU [Var CustomerOU]]]
If Not [Var SelectedOU]=[Blank] Then
If Ask "Are you sure you wish to
create: [Var UserName] in [Var CustomerOU] [Var SelectedOU]?" Then
'' Create new user and set properties
CreateUserPlain
[Var
CustomerInit]-[Var UserName],[Var Password],[Var SelectedOU]
SetUserName [Var CustomerInit]-[Var UserName],[Var FirstName],[Var LastName]
SetUserDisplayName [Var CustomerInit]-[Var UserName], [Var FirstName] [Var LastName]
SetUserPhoneNo [Var CustomerInit]-[Var UserName],[Var PhoneNo]
SetUserCustomProperty [Var CustomerInit]-[Var UserName],title, [Var Title]
DisableUserMustChangePassword [Var CustomerInit]-[Var UserName]
'' Copy groups from template user
Loop SelecedGroup,[UserGroups
[Var SelectedUser]]
If Not [LowerCase [Right [Var SelecedGroup] ,8]] = template Then
AddUserToGroup [Var CustomerInit]-[Var UserName], [Var SelecedGroup]
End If
End Loop
'' Copy username and domain from
template user
SetVar Domain, [replace
[UserCustomProperty userPrincipalName, [Var SelectedUser]], [Var SelectedUser]@,[Blank]]
SetUserCustomProperty [Var CustomerInit]-[Var UserName],
userPrincipalName, [Var UserName]@[Var Domain]
'' Copy logon script, home drive, etc
from template user
SetUserLogonScript [Var CustomerInit]-[Var UserName], [Userlogonscript
[Var SelectedUser]]
SetUserHomeDrive [Var CustomerInit]-[Var UserName], [UserHomeDrive
[Var SelectedUser]]
SetVar HomeDir, [UserHomeDir
[Var SelectedUser]]
If Not [Var HomeDir]=[Blank] Then
SetVar HomeDirTemp, [replace [Var HomeDir], [Var SelectedUser],[Blank]]
SetUserHomeDir [Var CustomerInit]-[Var UserName],[Var HomeDirTemp][Var CustomerInit]-[Var UserName]
End If
'' Notify hosting center admin that
the customer created a new user account
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var mailadr],Selfservice,_
User [Var SelectedUser] created by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
End If
End If
Goto Restart
/****************************
CHANGE USER ACCOUNT *****************************/
:Change user info
SetVar SelectedUser,[ListMenu Select user to
change info for,[UsersInOU [Var CustomerOU]]]
Set Name=[UserFirstName
[Var SelectedUser]]
Set SurName=[UserLastName
[Var SelectedUser]]
Set DisplayName=[UserCustomProperty
displayName,
[Var
SelectedUser]]
Set PhoneNo=[UserPhoneNo
[Var SelectedUser]]
Set Title=[UserCustomProperty
title,
[Var
SelectedUser]]
Set CompanyName=[UserCompany
[Var SelectedUser]]
MultiInput Edit user
information,Name,SurName,DisplayName,Title,PhoneNo,CompanyName
If Not VarIsEmpty Name Then
If Ask "Are you sure you wish to
correct info on [Var SelectedUser]?" Then
SetUserName [Var SelectedUser], [Var Name], [Var SurName]
SetUserDisplayName [Var SelectedUser], [Var DisplayName]
SetUserPhoneNo [Var SelectedUser], [Var PhoneNo]
SetUserCompany [Var SelectedUser], [Var CompanyName]
SetUserCustomProperty [Var SelectedUser],title, [Var Title]
ShowMessage "user
information changed for [Var SelectedUser]"
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var mailadr],Selfservice,_
User [Var SelectedUser] updated by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
End If
Goto Restart
/****************************
DELETE USER ACCOUNT *****************************/
:Delete user
SetVar SelectedUser,[ListMenu Select user to
delete,[UsersInOU [Var CustomerOU]]]
If Not VarIsEmpty SelectedUser Then
If Ask "Are you sure you wish to
delete [Var SelectedUser]?" Then
DeleteUser [Var SelectedUser]
ShowMessage "User [Var SelectedUser] is now
deleted"
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var MailAdr],Selfservice,_
User deleted [Var SelectedUser] by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
End If
Goto Restart
/****************************
UNLOCK USER ACCOUNT *****************************/
:Unlock user account
SetVar SelectedUser,[ListMenu Select user to
unlock,[UsersInOU [Var CustomerOU]]]
If Not VarIsEmpty SelectedUser Then
If Ask "Are you sure you wish to
unlock the user account for [Var SelectedUser]?" Then
UnlockUser [Var SelectedUser]
ShowMessage "User
account [Var SelectedUser] is now unlocked."
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var MailAdr],Selfservice,_
User account [Var SelectedUser] unlocked by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
End If
Goto Restart
/****************************
CHANGE USER PASSWORD ****************************/
:Change user password
SetVar SelectedUser,[ListMenu Select user to
change password for,[UsersInOU [Var CustomerOU]]]
If Not VarIsEmpty SelectedUser Then
SetVar Password,[InputPassword Enter new
password (Min 6 chars)]
If [Length [Var Password]] > 6 Then
If Ask "Are you sure you wish to
change password for [Var SelectedUser]?" Then
SetUserPasswordPlain [Var SelectedUser],[Var Password]
UnlockUser [Var SelectedUser] ''Just in case the user has tried with
bad passwords
ShowMessage "User [Var SelectedUser] can now
log on with the new password"
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var MailAdr],Selfservice,_
User password changed for [Var SelectedUser] by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
Else
ShowMessage "The
password must be at least 6 chars. Password not changed."
End If
End If
Goto Restart
/*****************************
SHOW USER'S GROUPS *****************************/
:Show user groups
SetVar SelectedUser,[ListMenuForced
Select
user,[UsersInOU
[Var CustomerOU]]]
SetVar SelectedGroup,[ListMenu User [Var SelectedUser] is member of:,[UserGroups
[Var SelectedUser]]]
Goto Restart
/*****************************
ADD USER TO GROUP ******************************/
:Add user to group
SetVar SelectedGroup,[ListMenu Select group,[GroupsInOU
[Var CustomerOU]]]
If Not VarIsEmpty SelectedGroup Then
SetVar SelectedUser,[ListMenu Select user to
add,[UsersInOU
[Var CustomerOU]]]
If Not VarIsEmpty SelectedUser Then
If Ask "Are you sure you wish to
add [UserFullName
[Var SelectedUser]] to the
group [Var SelectedGroup]?" Then
AddUserToGroup [Var SelectedUser],[Var SelectedGroup]
ShowMessage "User [UserFullName
[Var SelectedUser]] is now
member of [Var SelectedGroup]"
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var MailAdr],Selfservice,_
User [UserFullName
[Var SelectedUser]] is now member of
the group [Var SelectedGroup],_
added by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
End If
End If
Goto Restart
/***************************
REMOVE USER FROM GROUP ***************************/
:Remove user from group
SetVar SelectedGroup,[ListMenu Select group,[GroupsInOU
[Var CustomerOU]]]
If Not VarIsEmpty SelectedGroup Then
SetVar SelectedUser,[ListMenu Select user to remove
from the group,[GroupUsers [Var SelectedGroup]]]
If Not VarIsEmpty SelectedUser Then
If Ask "Are you sure you wish to
remove [UserFullName [Var SelectedUser]] from
the group [Var SelectedGroup]?" Then
RemoveUserFromGroup [Var SelectedUser],[Var SelectedGroup]
ShowMessage "User [UserFullName
[Var SelectedUser]] is now
removed from [Var SelectedGroup]"
SendMail [Var Smtpserver],25,[Var MailAdr],Self-Service,[Var MailAdr],Selfservice,_
User [UserFullName
[Var SelectedUser]] is now removed
from the group [Var SelectedGroup],_
removed by [LocalUserName]
on [ComputerName]
at [DateTime]
End If
End If
End If
Goto Restart