Fairly certain there are commands in game to allow this to be done, though you didn't specify ArcEmu or Mangos. So I'll post both.
Code:
.npc
.npc formationlink1
Access: m
Description: Sets formation master
Usage: .npc formationlink1
.npc formationlink2
Access: m
Description: Sets formation slave with distance and angle
Usage: .npc formationlink2 <distance> <angle>
.npc formationclear
Access: m
Description: Removes formation from creature
.npc info
Access: n
Description: Shows detailed information about selected npc
.npc npcfollow
Access: m
Description: Sets npc to follow you
.npc nullfollow
Access: m
Description: Sets npc to not follow anything
.npc vendoradditem
.npc vendorremoveitem
.npc flags
.npc emote
.npc delete
.npc addAgent
.npc listAgent
.npc say
.npc yell
.npc come
.npc return
.npc spawn
.npc spawnlink
.npc possess
.npc unpossess
.npc select
| vendoradditem | n | Adds to vendor |
| vendorremoveitem | n | Removes from vendor. |
| flags | n | Changes NPC flags |
| emote | n | .emote - Sets emote state |
| delete | n | Deletes mob from db and world. |
| addAgent | n | See [[ai_agent]] |
| listAgent | n | .npc listAgent |
| say | n | .npc say <text> - Makes selected mob say text <text>. |
| yell | n | .npc yell <Text> - Makes selected mob yell text <text>. |
| come | n | .npc come - Makes npc move to your position |
| return | n | .npc return - Returns ncp to spawnpoint. |
| spawn | n | .npc spawn - Spawns npc of entry <id> |
| spawnlink | n | .spawnlink sqlentry |
| possess | n | .npc possess - Possess an npc (mind control) |
| unpossess | n | .npc unpossess - Unposses any currently possessed npc. |
| select | n | .npc select - selects npc closest |
Commands 3.3.5 Trinity
for trinity, too long to post.