Jump to content

Recommended Posts

Posted

Morning,

 

I have DIRSYNC setup which uploads all the users in defined OU's to the cloud but have a couple of questions.

 

Is there a way to set the user location of the accounts in the domain so it uploads to the cloud without scripting. Actually is there a way to assign licenses without having to script?

Where does it get the security groups from? I have 4 that its synced and they seem to be random.

 

Just curious because I have spent hours trawling through the internet looking for clever scripts to automate this stuff and I hate scripting, its all dutch to me.

Posted

Is there a way to set the user location of the accounts in the domain so it uploads to the cloud without scripting.

If you mean their geographical location, it's a case of either script it or use the portal interface.

 

Actually is there a way to assign licenses without having to script?

Well you can assign them manually via the Portal, but otherwise you need to script it (examples can be found within this forum ;))

 

Where does it get the security groups from? I have 4 that its synced and they seem to be random.

With DirSync, it will pick up security groups from OU's that you have specified to synchronise

 

Just curious because I have spent hours trawling through the internet looking for clever scripts to automate this stuff and I hate scripting, its all dutch to me.

As again, a few of us already have the powershell scripts posted within Edugeek forums that will take your synchronised users and assign the licences/mailbox policies so all you really need to do is add it to a scheduled task on a server. I run ours hourly from 8am until 6pm.

Posted

When you say you have it synching users from defined OU's, are these ones you defined yourself or have you just got it to sync your entire directory?

 

And yes, you have to use a script if you want to automate the licence assignment :( Which sucks

Posted
Force yourself to learn enough Powershell to get through the script-based tasks and it'll serve you well in the future, it's a very powerful tool :)
Posted
Force yourself to learn enough Powershell to get through the script-based tasks and it'll serve you well in the future, it's a very powerful tool :)

 

I think I am starting to realise that the admin portal website is a viewer and if you want to do anything useful you have to use scripts. I guess I am just lazy and like a GUI, back to 1985 I go

Posted
I think I am starting to realise that the admin portal website is a viewer and if you want to do anything useful you have to use scripts. I guess I am just lazy and like a GUI, back to 1985 I go

 

No, MS is lazy. When thy brought out PS they said they would still provide support for GUI tools then promptly did everything is PS and tacked on a few slow hack gui shells on top. I still prefer Exchange 2003 as once they went PS it became slow and cumbersome to actually use in comparison.

 

MS has stopped developing the configuration layer, you are now expected to develop it yourself every single time which explains o365 sharepoint when it comes to education also. We must get used to the fact that now at least half of our jobs are remaking the wheel over and over and over again. If you have tickets to 1985 can I come with you??

  • Thanks 1
Posted
No, MS is lazy. When thy brought out PS they said they would still provide support for GUI tools then promptly did everything is PS and tacked on a few slow hack gui shells on top. I still prefer Exchange 2003 as once they went PS it became slow and cumbersome to actually use in comparison.

 

MS has stopped developing the configuration layer, you are now expected to develop it yourself every single time which explains o365 sharepoint when it comes to education also. We must get used to the fact that now at least half of our jobs are remaking the wheel over and over and over again. If you have tickets to 1985 can I come with you??

 

Thank god I am not alone in the fight.

 

Spent an hour now looking for a decent script that suits my needs but given up for now. I don't want to have to mess around with attributes to define kids and teachers in my active directory and I just want to assign part of the A2 license as I don't want exchange or lync. I will come back to it later.

 

But I sorted it myself anyway.

 

I added the word student to the Departments bit of ADUC (around 30 seconds) for all my users.

 

I created a view which looks for the student in Departments (30 seconds) and unlicensed.

 

Selected 20 at a time, and edited them and assigned licenses. if it showed 50 it would only take me 2 minutes to do them all.

 

I know its not automated but I have done all my users (only 400 or so) in 5 minutes and I don't feel like Neo from The Matrix

Posted

To do something similar in Powershell, the following would assign just email access (no sharepoint/lync/web based office apps) to people where department = student

 

 

First define a variable to hold the license customization we want:

 

$nostustuff =new-msollicenseoptions –accountskuid NameOfSchool:STANDARDWOFFPACK_STUDENT –disabledplans SHAREPOINTWAC_EDU,SHAREPOINTSTANDARD_EDU,MCOSTANDARD

 

Then run a line which pulls in all unlicensed users, with a department set as 'student' and then assign them the above options:

 

get-msoluser -all | where-object {($_.islicensed -ne "True") -and ($_.department -eq "Student")}| set-msoluserlicense –licenseoptions $nostustuff     

Posted

I've posted this script before, and it will do most of what you want.

In this case it's only enabling exchange, but you get the idea.

It will search for users who's Office is Student (change as required) and then set licensing and location.

 

#Set the license options for Office 365, which in this case is just Exchange access

$LicOptions = New-MsolLicenseOptions -AccountSkuId tenancy:STANDARDWOFFPACK_STUDENT -DisabledPlans MCOSTANDARD, SHAREPOINTWAC_EDU, SHAREPOINTSTANDARD_EDU

#Search for users that have no licences as they have just been syncronised and store into array where username begins STU

$users = Get-MsolUser -UnlicensedUsersOnly -Synchronized -MaxResults Unlimited | Where-Object {$_.Office -eq "Student" }

#If we have no users then we can exit out of the script

if (!($users)) {exit;}

 

#For each user we found, we will loop thought them and apply settings

Write-Host "Set Licence"

foreach ($user in $users)

{

#Displays on screen the user we are updaing purely for debugging purpose

Write-Host $user.UserPrincipalName

#Set the Location to GB for the user which resolves the "error" that is detected

Set-MsolUser -UserPrincipalName $user.UserPrincipalName -UsageLocation GB

#Set the Office 365 license for the user based on the value selected above. This is purely for students

Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses "tenancy:STANDARDWOFFPACK_STUDENT" -LicenseOptions $LicOptions

}

  • 2 weeks later...
Posted

Why is powershell so crap. I have been sat here for hours so far, trying to run

 

$nostustuff =new-msollicenseoptions –accountskuid NameOfSchool:STANDARDWOFFPACK_STUDENT –disabledplans SHAREPOINTWAC_EDU,SHAREPOINTSTANDARD_EDU,MCOSTANDARD

 

yes I changed the NameofSchool

 

get-msoluser -all | where-object {($_.islicensed -ne "True") -and ($_.department -eq "Student")}| set-msoluserlicense –licenseoptions $nostustuff

 

keep getting

 

Set-MsolUserLicense : Unable to assign this license because the license options are invalid.

At line:1 char:118

+ get-msoluser -all | where-object {($_.islicensed -ne "True") -and ($_.department -eq "Student")}| set-msoluserlicense <<<< -licenseoptions$nostustuff + CategoryInfo : OperationStopped: (:) [set-MsolUserLicense], MicrosoftOnlineException +FullyQualifiedErrorId :Microsoft.Online.Administration.Automation.InvalidUserLicenseOptionException,Microsoft.Online.Administration.Automation.SetUserLicense

 

any one got any ideas?

 

Paul

Posted

A couple of things for you:

 

1) Run the following command to make sure you are using the correct name in place of the School name:

 

Get-msolaccountsku

 

2) The above scripts assume you have populated the Department variable of your Active Directory user accounts with the value of 'Student'. This is not done by default and without it the powershell system will error out. To sort this out, highlight all of your users in the AD and right-click, properties. Go to the Organisation tab and fill in the Department box.

 

You will either have to wait for the next replication of DirSync or force an update for the changes to propagate. Then the powershell should work

Posted
That error crops up if you try and licence a user that already has licences assigned, though quite why it manifests in that way I don't know. It's usually a sign for me that I've not swapped the correct CSV in while I migrate, you might have to check your conditional logic - instead of assigning a licence tweak the script to output details of the users so you can check it's genuinely returning unlicensed users.
  • 1 month later...
Posted

This didn't work for me I got the error:

 

"PS C:\Users\zak\Desktop> Get-msoluser | set-msoluser -usagelocation "GB"

WARNING: More results are available. Please specify one of the All or

MaxResults parameters."

 

help :)

Posted
What does that GB powershell solve?

 

It sets the location for the user to the United Kingdom. Its a mandatory field. That determines what datacentre to store the data.

Posted
This didn't work for me I got the error:

 

"PS C:\Users\zak\Desktop> Get-msoluser | set-msoluser -usagelocation "GB"

WARNING: More results are available. Please specify one of the All or

MaxResults parameters."

 

help :)

 

Hi,

 

Use the following command

 

Get-MsolUser -All | Set-MsolUser -UsageLocation "GB"

The -All switch will bring back all of the users, at least then you won't have to know how many users you have to the specify a limit

 

GB = Location

 

If you want to check what is currently set, use the first part of the command before the PIPE (|)

James,

  • Thanks 1
Posted
It sets the location for the user to the United Kingdom. Its a mandatory field. That determines what datacentre to store the data.
I've just been reading up, and apparently the data centre is decided when you sign up, not because of this command?
Posted
I thought the GB was just to set the users location so they did not get the prompt on first login and nothing to do with the data centre (since educational accounts get the European ones for us)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...