+ Post New Thread
Results 1 to 5 of 5
Cloud Services Thread, [O365] Dynamic Distribution Group in Technical; ...
  1. #1
    foofighterjim's Avatar
    Join Date
    Nov 2011
    Location
    Birmingham
    Posts
    417
    Thank Post
    30
    Thanked 78 Times in 59 Posts
    Rep Power
    28

    [O365] Dynamic Distribution Group

    I am tying to create Dynamic Distribution groups for our Students and Staff.

    The way our accounts have been provisioned (RM Unify) is that the distinguishing field is Job Title.

    I have started testing with the students group but I am getting no joy. Here is the script I am trying to use:

    Code:
    New-DynamicDistributionGroup -Name "All Pupils Test" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Title –eq 'Student')}
    Following instructions from: Manage Distribution Groups by using PowerShell - o365info.com

    However I get the following error when run:

    error.jpg

    Can anyone see where I am going wrong?

  2. #2
    Boredguy's Avatar
    Join Date
    Jun 2011
    Location
    Swindon
    Posts
    600
    Thank Post
    4
    Thanked 133 Times in 124 Posts
    Rep Power
    50
    New-DynamicDistributionGroup -Name "Pupil Test" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Title -eq 'Student')} created a new DDG happily for me

  3. Thanks to Boredguy from:

    foofighterjim (2nd May 2014)

  4. #3
    foofighterjim's Avatar
    Join Date
    Nov 2011
    Location
    Birmingham
    Posts
    417
    Thank Post
    30
    Thanked 78 Times in 59 Posts
    Rep Power
    28
    I am really stuck here then. The only thing I find strange when I am trying this is my connection method.

    At the start of most of my scripts I use:

    Code:
    Connect-MsolService
    However when using this for this command I get a error saying the cmdlets are not found. Instead if I use the following:

    Code:
    $UserCredential = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    It loads the cmdlets and allows me to run. Could this be causing my problem?

  5. #4
    Boredguy's Avatar
    Join Date
    Jun 2011
    Location
    Swindon
    Posts
    600
    Thank Post
    4
    Thanked 133 Times in 124 Posts
    Rep Power
    50
    We use the following connection strings for our scripts as most of them are automated
    Code:
    Import-Module MSOnline
    $password = "Blahhblahblah"
    $username = "adminaccountname@wibbleschool.onmicrosoft.com"
    $securepass = ConvertTo-SecureString -AsPlainText -String $password -Force
    
    $LiveCred = New-Object System.Management.Automation.PSCredential -argumentlist $username,$securepass
    
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    Connect-MsolService -Credential $LiveCred
    If is does not know what cmdlets to install it will get upset, but we have found that the above, while overkill at times, works nicely and means we can also just load a single ps1 file to connect to 365 via Powershell ISE, then carry on with the rest of the commands manually

  6. Thanks to Boredguy from:

    foofighterjim (2nd May 2014)

  7. #5
    foofighterjim's Avatar
    Join Date
    Nov 2011
    Location
    Birmingham
    Posts
    417
    Thank Post
    30
    Thanked 78 Times in 59 Posts
    Rep Power
    28
    Thanks for that, I am still not able to do it but may try over the weekend (away from any potential domain and internet issues).

SHARE:
+ Post New Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •