concept new user in category powershell

This is an excerpt from Manning's book Learn PowerShell Scripting in a Month of Lunches.
It’s easy to think, “Well, provisioning a new user is a single task.” No, it isn’t. It’s a process, and if you think about how you’d perform it manually, you’d realize instantly that it consists of multiple actual tasks. You have to create the user, set up a home folder, create a user library in SharePoint, and so on. Were you to start coding the process, you’d create a tool for each task: new user, new home folder, SharePoint account, and so forth (many of those tasks can be accomplished using tools Microsoft has already written). You’d then “connect” those tools together, into a process, by writing what we call a controller script.
This is our classic “tools versus controllers” example. Think about what goes into provisioning a new user in your organization. You probably have to set up an account, mailbox-enable it, set up a home folder somewhere, maybe add them to something in SharePoint, and so on. Each of those is obviously a discrete task within the process, and each of those tasks should be a tool. Many of those tools—like New-ADUser—are provided by Microsoft.
There’s an opportunity to be clever here, too. For example, where do you set up the new home folder? What’s your normal business logic? “Well, we look at the existing file servers, and we usually don’t put more than 1,000 users per home folder file server. So we find a server with less than 1,000 home folders already, and use that one. But if the server we pick has less than 75 GB free, then we leave it alone and pick another one.” That’s a task, and it’s one you could automate. Perhaps you’d create a Select-UserHomeFolderFileServer tool that does all the analysis and returns a list of eligible servers, and then a New-UserHomeFolder tool that uses the first eligible server to create the new user’s home folder on. Those are two discrete tasks and should be two discrete tools.