My goals with this script were to save time with the off-boarding procedures, but when I put it together it was kind of a manual hodge podge of scripts, lists and scheduled tasks. I went to clean it up a bit and hopefully have an easy to follow process to get it up and running. If you are going to try using this, after you download the files from GitHub give this a review and let me know how it goes!
First get the files extracted to a network share somewhere, that only your IT admins and the service account have access to.
The ServerScripts folder has the main scripts that are used in the launch pad and also by the process server.
Login to the designated process server, as the service account you’re going to use. That part is important. Open up the OffboardingImports.ps1 file in ISE and then highlight and run the line for the global server source path.
Then see below it, some one-time use lines. Run the first line, without the hashtag that comments it out.
Within the prompt, type in the windows password for the service account that you’re logged in as.
Next run the line right below that one. This will take your entered password, encrypt it, and store it in the network share for use by the scheduled tasks.
Then back in ISE, highlight all the remaining lines. Ensure you get all the global variables and the entire function. I usually minimize the function so it’s less lines to highlight.
Then highlight just the name of the function, and run that.
It should take several seconds, a couple errors will be returned (due to the new scheduled tasks not already existing) and then the tasks should be created.
One other thing, look for and load the function called Get-UserMgmtAssignToUsers.
Then highlight just the function name and execute that. This takes your service account and your “assign to” user/group for any manual tasks, gets their user object and stores it so the scripts can create tasks properly later on.
Check in Task Scheduler to ensure you see two new tasks: OffboardingTasksCreate and OffboardingTasksPerform.
Next, open the OffboardingTasksCreate.ps1 file. Highlight and load all the variables and functions that are in that file.
Then expand the New-UserMgtTasksProjectStart function and just highlight the first set of lines. Basically everything from the beginning to before the $Web line. Run just the selection. This will connect to SharePoint Online as your service account and create the new empty lists that are needed.
Stay tuned for some more instructions related to populating the off-boarding task templates and then running the GUI tool to leverage them!