The first script will create an Active Directory structure under the Organizational Unit named
"Hosting". When the script is executed, the script prompts for information about the new customer:
The short name is used as a prefix for all new Active Directory objects. Entering "Acme Corporation"
as the name and "Acme" as the short name, will produce an Active Directory structure like this:
''==== Input
new customer information ====
MultiInput Create new
customer,Customer,ShortName|Short name,Domain
''==== Test
cancel ====
If VarIsEmpty Customer Then Exit
''==== Create
new OUs under the "Hosted" OU ====
CreateOU [Var Customer], Hosted
''==== Create
computers, servers and users OU under the customers OU ====
CreateOU [Var ShortName]-Computers, [Var Customer]
CreateOU [Var ShortName]-Servers, [Var Customer]
CreateOU [Var ShortName]-Users, [Var Customer]
''==== Create
global groups for the customer ====
CreateGlobalGroup [Var ShortName]-user, [Var Customer]
CreateGlobalGroup [Var ShortName]-manager, [Var Customer]
CreateGlobalGroup [Var ShortName]-admin, [Var Customer]
CreateGlobalGroup [Var ShortName]-template, [Var Customer]
''==== Create
a template user to create new users from ====
CreateUserPlain [Var ShortName]-Standard,NoPass1234,[Var ShortName]-Users
SetUserName [Var ShortName]-Standard,[Var ShortName],Standarduser
SetUserDisplayName [Var ShortName]-Standard, [Var ShortName] Standarduser
SetUserHomeDir [Var ShortName]-Standard,
"\\montessrv\home\[Var ShortName]-template"
SetUserHomeDrive [Var ShortName]-Standard,
"k:"
SetUserLogonScript [Var ShortName]-Standard,
"FTLogon.exe"
SetUserDescription [Var ShortName]-Standard, UB
DisableUser [Var ShortName]-Standard
AddUserToGroup [Var ShortName]-Standard, [Var ShortName]-user
AddUserToGroup [Var ShortName]-Standard, [Var ShortName]-template
SetUserCustomProperty [Var ShortName]-Standard,
userPrincipalName, Standarduser@[Var Domain]
''==== Create
self-service user for the customer ====
SetVar ServiceCode, S[Random 9][Var ShortName][Random 9][UpperCase
[Var ShortName]][Random 9]u
CreateUserPlain [Var ShortName]-selfservice,[Var ServiceCode],[Var ShortName]-users
SetUserName [Var ShortName]-selfservice,[Var ShortName],selfservice
SetUserDisplayName [Var ShortName]-selfservice, [Var ShortName] selfservice
SetUserDescription [Var ShortName]-selfservice, UB
AddUserToGroup [Var ShortName]-selfservice, [Var ShortName]-user
AddUserToGroup [Var ShortName]-selfservice,
Domain admins
SetUserCustomProperty [Var ShortName]-selfservice,
userPrincipalName, service@[Var Domain]
''==== Create
share for self-service user ====
MakeDir \\montessrv\home\[Var Customer]
CreateShare C:\Hosting\[Var Customer],\\montessrv\home\[Var ShortName]-Hosted
SetDirPermissions \\montessrv\home\[Var Customer],Administrator:FC
AddDirPermissions \\montessrv\home\[Var Customer],[Var ShortName]-user:RE,[Var ShortName]-user:M,[Var ShortName]-user:W
SetSharePermissions \\montessrv\home\[Var ShortName]-Hosted,Administrator:Full
Control
AddSharePermissions \\montessrv\home\[Var ShortName]-Hosted,[Var ShortName]-user:change
''====
Complete ====
ShowMessage Customer [Var Customer] created
successfully.
Users in the Montes Hosting setup are mainly Remote Desktop Services users and the Montes administrator
puts a script on the desktop of the person that must be the user account administrator at the
customer company. When the customer administrator then starts the icon on the desktop, it looks like this:
script. When for example the option to create a new user is chosen, the script prompts for new user information:
The complete original script is listed below. The Montes administrator sets the variables at the top, when
the script is copied to the customer administrators desktop. FastTrack Software prefers to list the original
material, but the information could have been stored in properties on the Active Directory customer
administrator account and then be read from there, to have an identical script for all customers.
'' 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