CAWJames Posted October 13, 2015 Author Posted October 13, 2015 Hoopla! She rides SSIS runs and pulls from an SQL view all the details of the student and dumps it into a CSV file, all formatted proper like. Then the powershell script above runs and checks each student against O365 and if it doesn't find a match it makes a student account, assigns the Student Plus licence and then sends an email with the password and new email address to the students own email address(as outputted by the SSIS). All zero touch with a file that tells us if a student has been assigned an account(which we would most likely do in O365 itself, but logging is good practice ) I assume we are in the minority of having no standard student account structure(AD,Sims etc), just all in SQL for our bespoke admin system/Moodle, so if this helps anyone else in the same situation, please use and adapt for your own nefarious porpoises As long as you can output a CSV with your data, it should work. James
altecsole Posted October 14, 2015 Posted October 14, 2015 Glad you got it working. Just out of interest, I use a log function that I can call when I want to write to a log file; it may be of benefit, or maybe not: function Write-Log { # Write to log file Param($header, $Message) $log_date = Get-Date Write-Output "[$($log_date)]: [$($header)]: $($Message)" >> $file_name } You'll need to set your log file location at the start of your script - I set a different one for each day: # File name should end up as: YYYY-MM-dd_Name.txt $LogDirectory = 'c:\Scripts\' $this_date = Get-Date $format_date = $this_date.ToString('yyyy-MM-dd') $file_name = "$($format_date)_Name.txt" $file_name = $LogDirectory.TrimEnd('\') + "\$($file_name)" #write to log file in script; example Write-Log 'Script running' 'Checking input file hours'
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now