CAWJames
Members-
Posts
1,390 -
Joined
-
Last visited
Content Type
Forums
News
20th
EduGeek EDIT Conference
Blogs
Everything posted by CAWJames
-
Are there any updates on this, I would like to be able to report on this too?
-
Oh well, mine still going strong, only had to go back for one failed upgrade and they replaced the whole thing. Only annoyance is the Lollipop upgrade, some have it, some don't, I am one of the latter really starting to get to me, I want my upgrade!!
-
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
-
Added a blurb variable with Creating user in it and went with the below: write-output "$($blurb) $($line.Displayname) $($line.UserPrincipalName)" | Out-File -append $filename Happy bunny now Thanks all, think I am ready to deploy to the whole student population now, scary
-
needed an -append on the outfile still strange it is on 3 lines, rather than all on the one line though?
-
Ok tested it and while it silently creates the account, and makes a log file it only outputs the last person created, on 3 seperate line, which is weird as Write-host output each one as it creates, is my Out-file in the wrong place? Thanks for this again, James
-
Again I am tweaking my script! Need to change the write-hosts to something that will log the outcome to a file, so it will show date time username and when an account was created. Write-host was great for testing, but not when a script is running in the background! If I remove write-host "User exists" what would I put in its place or can I go leave the if blank and curly bracket straight to the else? write-host "Creating user" is the bit I need to log and then I need to add UPN and display name, would it be as simple as write-output "Creating User" $line.Displayname $line.UserPrincipalName | Out-File C:\filename.txt will this append a file? Is there anyway to output a new file name every time that is date stamped with a variable or some other way of doing it, so that every time the script runs it outputs a log list of names and UPN we can interrogate? Thanks to all the powershell gurus in advance James
-
All well and good if our students had an email address in the first place... Our student accounts all reside in an SQL database for Moodle use, with no email. We are now giving them email and ProPlus, but with no AD structure for ADSync to pick from, we have basically made this script to convert Moodle accounts in to O365 accounts automagically hope that makes sense James
-
Ok, cracked it, below is an auto script that creates O365 accounts from a CSV file, checks if the user is already in 0365 and emails them an HTML email with their password details, which is the actual one outputted by O365. I hope this script will help others achieve the same goals It also auto logs into o365 powershell, so if you run this more than once in a session, comment out the 2nd,3rd,4th,5th lines. The password is held in a text file on the hard drive, this can be created by running the following and entering your password in the box: read-host -assecurestring | convertfrom-securestring | out-file C:\admincred.txt Apart from that, HTML can obviously be infinitely adjusted, and you can add as much instruction as you want in the body. Again hope it helps someone else, it has taken me a long time to piece it together! Also thanks to all those in this thread who have added bits too #Powershell script for Bulk update of Alternate Email addresses and reset passwords and send email notification to end users with their new passwords. import-module msonline $pass = cat C:\admincred.txt | convertto-securestring $mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist "[email protected]",$pass $O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Authentication Basic -AllowRedirection -Credential $mycred Import-PSSession $O365Session Connect-MsolService -Credential $mycred $From = "[email protected]" $SMTPServer = "IP of Exchange server/SMTP server" $SMTPPort = "25" $Username = "domain\administrator" $Password = "PASSWORD" $subject = "Your Office365 Password is attached!" $input=Import-csv D:\Sources\O365Sync\StudentOutput.csv Foreach($line in $input){ $msoluser = Get-MsolUser -UserPrincipalName $line.UserPrincipalName -ErrorAction SilentlyContinue if($msoluser){ write-host "User exists" } else{ write-host "Creating user" $To = $line.AlternateEmailAddress $messageSubject = "Here are your new Office 365 login details!" $message = New-Object System.Net.Mail.MailMessage $From, $To $message.Subject = $messageSubject $style = "body { font-family: Verdana; font-size:13px; color:#333;}" $style = $style + "p { margin: 0px 0px 15px 0px; font-size:13px; color:#333;}" $style = $style + "h1 { font-family:Verdana; font-size:32px; color:#B82234; margin-top:15px; margin-bottom:7px; text-align:center;}" $style = $style + "h2 { font-family:Verdana; font-size:18px; color:#333; margin-top:15px; margin-bottom:7px;}" $style = $style + "h3 { font-family:Verdana; font-size:16px; color:#333; margin-top:15px; margin-bottom:7px;}" $style = $style + "h4 { font-family:Verdana; font-size:13px; color:#333; margin-top:15px; margin-bottom:7px;}" $style = $style + "a {color: #B82234; font-family: Verdana; font-size: 13px; text-decoration:underline;}" $style = $style + "a img { border:0px;}" $style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}" $style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }" $style = $style + "TD{border: 1px solid black; padding: 5px; }" $style = $style + ".coloured p {color:#fff;}" $style = $style + ".coloured h1 {color:#fff;}" $style = $style + ".coloured h2 {color:#fff;}" $style = $style + ".coloured h3 {color:#fff;}" $style = $style + ".coloured h4 {color:#fff;}" $style = $style + ".coloured a {color:#fff;}" $style = $style + ".reded p {color:#B82234;}" $style = $style + ".reded h1 {color:#B82234;}" $style = $style + ".reded h2 {color:#B82234}" $style = $style + ".reded h3 {color:#B82234;}" $style = $style + ".reded h4 {color:#B82234;}" $style = $style + ".reded a {color:#B82234;}" $style = $style + "" $body = @" http address of logo Welcome to Office365 Please find your username and password below, you can use these at https://login.microsoftonline.com "@ $footer = @" {PromoTitle} {PromoBody} Contact Us Tel: Phone | Fax: Fax | Email: [email protected] http://www.domain.com Address, Address Centre Information If you no longer wish to receive these emails, please unsubscribe. "@ $message.IsBodyHTML = $true $message.Body = New-MsolUser -FirstName $line.FirstName -LastName $line.LastName -UserPrincipalName $line.UserPrincipalName -AlternateEmailAddresses $line.AlternateEmailAddress -Department $line.Department -DisplayName $line.Displayname -UsageLocation GB -LicenceAssignment DOMAIN:STANDARDWOFFPACK_IW_STUDENT | Select-Object UserPrincipalName,Password | ConvertTo-Html -head $style -body $body $smtp = New-Object Net.Mail.SmtpClient($smtpServer) $smtp.Send($message) } }
-
Yeah, unfortunately, it is a flat file export from an SSIS package so goes no where near Excel. I need the package to create a password in a new field before exporting, so just not sure which task to use for this, derived column or such like. I have a validation, so it checks the CSV first for names already created(as it would create a new password every time for every user, although that would be ignoed by the creation script it would render the passwords different every time the SSIS package is run.
-
Hi all, Another issue for our students in Office 365. Currently we run a hybrid Ex2010 enviroment with all our mail running through EOP. All our on-prem boxes(staff) work fine, mail in, mail out, but our newly created cloud-only accounts(students) won't get any email, the sender just gets an #550 5.1.1 RESOLVER.ADR.RecipNotFound; not found ## NDR back There must be somewhere for Ex2010 to see the cloud only addresses for routing, anyone any idea what we are doing wrong? do we have to have remote mailboxes for each O365 cloud user(which seems a major faff!) Thanks James
-
Right, back at the rock face... i am now creating the SSIS package to export everything to the csv. This is fine with a source, a data conversion(some field types are incompatible for the next step), a derived column(to make UPN etc,) and an output to CSV. I am currently trying to work out how to do the passwords and where. Do I use a script transformation or an expression in the derived column, I am currently running around in circles!! I need something that creates an O365 compatible complex password that adds into a column called Password. It could do this at any point, even at SQL level before the SSIS package. Anyone have any insight into this? Thanks James
-
I'd second serial ports or console ports, best way. I have an old XP toughbook with Ubuntu on it. A selection of Cisco, hp and general serial console cables and I can pretty much use minicom on the laptop to enter any switch and have a look. You will probably need passwords for any changes, not sure how Netgear work, and as above if they actually have serial ports!! At least if you can get an IP, you can work out if there is a management vlan. I have had to look up old admins in the past, and offer them beer and/or computer parts to give me passwords!!
-
Right, not sure who's fault(mine i would assume), but switch turns out to be fine... I bought it back to base and rang HP support, told her it was not linking and gibberish on the console, and she disappeared for a few minutes and asked me my baud speed, 9600 I proclaimed, she then she says this is a Comware switch, try 38400... So I did and it fired out some console output that was readable. Cock. So, added an IP, and it looks like it is working, haven't tried the 10GB yet, that will have to wait until next week. So moral of the story, is HP Networking is not always ProCurve!
-
We purchased a 60m 8 core OM3 cable, and the maintenance guy installed it through the floor and false ceilings, an LC patch panel each end and we are sorted We already have the 10GB patch cables for the original IRF idea, but we can use these to connect the fixed 1950 to one of the 5800 as a server room edge. An abundance of POE+
-
Morning all, Turns out to be a DOA switch, well that's initial diagnosis anyway. No link lights and gibberish from the console. We ended up creating an IRF with 2 5800's with 2 10GB links between our 2 floors (original idea was IRF with both 5800's in the server room and then the 1950 as the edge downstairs, but this makes more sense, effectively extending the server room )
-
Yes to all 3, and it is an pre terminated/tested 60m then installed fibre. Will have to wait till Monday now, as I will be on site and it will hopefully be obvious why it is not working(I was remotely "steering" the technician today) Thanks James
-
Afternoon all, We have been having a bit of a to do, to try and get our 2 switches to speak to each other over 10GB fibre. We have a 8 core fibre, multicoloured to LC connectors. We have a 10GB SFP+ in the 5800, and the same in the 1950, but whatever combination of fibre we try(we are using the red and white cores, and tried them reversed and normal), we cannot get it to link. Is there some special command on either switch to enable the connection? Thanks for any input, we will try proper support on Monday, but thought to ask the forum first, maybe something really stupid!! James
-
I will get it installed tomorrow on a server and post back my results. Hopefully this will be useful to others, so makes sense to keep it updated. Thanks again James
-
Ah good point, the 2 lines need to be swapped out, as $line is referenced before at the moment, so: #Powershell script for Bulk update of Alternate Email addresses and reset passwords and send email notification to end users with their new passwords. $From = "Office365Admin@ourdomain" $SMTPServer = "OurSMTPServer" $SMTPPort = "25" $Username = "adminuser" $Password = "password" $subject = "Your Office365 Password is attached!" $input=Import-csv C:\temp\Output365b.csv Foreach($line in $input) $msoluser = Get-MsolUser -UserPrincipalName $line.UserPrincipalName -ErrorAction SilentlyContinue if($msoluser){ write-host "User exists" } else{ write-host "Creating user" New-MsolUser -FirstName $line.FirstName -LastName $line.FamilyName -DisplayName $line.DisplayName -Department $line.Department -UserPrincipalName $line.UserPrincipalName -AlternateEmailAddresses $line.AlternateEmailAddress -LicenceAssignment DOMAIN:STANDARDWOFFPACK_IW_STUDENT #Set-MsolUserPassword -UserPrincipalName $line.UserPrincipalName -NewPassword $line.Password $To = $line.AlternateEmailAddress $body = "Hi " + $line.FirstName + " Here is your new Office365 email address: " + $line.UserPrincipalName + " &" + " this is your new Office365 password: " + $line.Password + " Please use these credentials to login at https://login.microsoftonline.com" $SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer,$SMTPPort) $SMTPClient.Credentials = New-Object System.Net.NetworkCredential($Username,$Password) $SMTPClient.Send($From, $To, $subject, $Body) }
-
Excellent, should have thought of that! So adding your snippet, the below should take care of only sending to new users, just need to work out the passwords now, make SQL create a random password on creation/update of the CSV and then use the hashed out Set-MsolUser line to change the users password and send that OR find someway to pass the O365 generated password into the email, is it even me worth working on the latter? Thanks again James #Powershell script for Bulk update of Alternate Email addresses and reset passwords and send email notification to end users with their new passwords. $From = "Office365Admin@ourdomain" $SMTPServer = "OurSMTPServer" $SMTPPort = "25" $Username = "adminuser" $Password = "password" $subject = "Your Office365 Password is attached!" $input=Import-csv C:\temp\Output365b.csv $msoluser = Get-MsolUser -UserPrincipalName $line.UserPrincipalName -ErrorAction SilentlyContinue Foreach($line in $input) if($msoluser){ write-host "User exists" } else{ write-host "Creating user" New-MsolUser -FirstName $line.FirstName -LastName $line.FamilyName -DisplayName $line.DisplayName -Department $line.Department -UserPrincipalName $line.UserPrincipalName -AlternateEmailAddresses $line.AlternateEmailAddress -LicenceAssignment DOMAIN:STANDARDWOFFPACK_IW_STUDENT #Set-MsolUserPassword -UserPrincipalName $line.UserPrincipalName -NewPassword $line.Password $To = $line.AlternateEmailAddress $body = "Hi " + $line.FirstName + " Here is your new Office365 email address: " + $line.UserPrincipalName + " &" + " this is your new Office365 password: " + $line.Password + " Please use these credentials to login at https://login.microsoftonline.com" $SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer,$SMTPPort) $SMTPClient.Credentials = New-Object System.Net.NetworkCredential($Username,$Password) $SMTPClient.Send($From, $To, $subject, $Body) }
-
Bit of an update, it didn't quite go to plan!! I have ended up outputting to a CSV from the database, so it formats everything right for the script. I then had it create a random password in the O365 form, and then used Set-MsolUser to set it. and then outputted using the details in the CSV to email to send passwords to their alternate address: #Powershell script for Bulk update of Alternate Email addresses and reset passwords and send email notification to end users with their new passwords. $From = "Office365Admin@ourdomain" $SMTPServer = "OurSMTPServer" $SMTPPort = "25" $Username = "adminuser" $Password = "password" $subject = "Your Office365 Password is attached!" $input=Import-csv C:\temp\Output365b.csv Foreach($line in $input) { New-MsolUser -FirstName $line.FirstName -LastName $line.FamilyName -DisplayName $line.DisplayName -Department $line.Department -UserPrincipalName $line.UserPrincipalName -AlternateEmailAddresses $line.AlternateEmailAddress -LicenceAssignment DOMAIN:STANDARDWOFFPACK_IW_STUDENT #Set-MsolUserPassword -UserPrincipalName $line.UserPrincipalName -NewPassword $line.Password $To = $line.AlternateEmailAddress $body = "Hi " + $line.FirstName + " Here is your new Office365 email address: " + $line.UserPrincipalName + " &" + " this is your new Office365 password: " + $line.Password + " Please use these credentials to login at https://login.microsoftonline.com" $SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer,$SMTPPort) $SMTPClient.Credentials = New-Object System.Net.NetworkCredential($Username,$Password) $SMTPClient.Send($From, $To, $subject, $Body) } This works fine for the first run, BUT we want this CSV to be updated on a schedule and the script run on a schedule, so that it picks up new users and just errors on ones that already have accounts. The problem with this script, it will email the students every script run with their password, which isnt brilliant. What I need to do is somehow get the output from the New-MsolUser Password output and then input it into the email instead of the column from the CSV, AND to somehow get the password sending bit encapsulated in the New-MsolUser line, so it doesn't send to all in the CSV only the ones that output a new user. Does that make sense? My script-fu is not working at the moment!! Thanks James
-
you star! Didn't finish the process off in VLSC, all going now!!
-
Hi all, We have "Office 365 ProPlus for Faculty" as a licence in our 365 portal, but no similar for students, ie "Office 365 ProPlus for Students". All I can assign to student accounts is "Office 365 Education for students". How do I go about getting licences assigned for free, as they have a £ value in the purchasing section. We tried to get them added by reseller, but they just got a load of MAKs assigned in the VLSC, which isn't quite right! OR is this not how we "give" ProPlus to students? Thanks James
-
Core switch - Where to buy and maybe what to buy
CAWJames replied to CAWJames's topic in Wired Networks
Always open to other options!
