powershell
8 Topicsdynamic group based on assigned license
Hi, is it possible to create a group with users based on a assigned license? So i want to include all users into this specific group who has e.g. an E3 license assigned, but not an E5. It seems, that the only way is to use the a ServicePlan name, not a SKU name, isn't it? Even better would be a dynamic membership rule based on the SKU, not on a ServicePlan. What i tried to do: 1. Get-MsolAccountSKU to find out the SKU name 2. Created a dynamic group without knowing which syntax to use :D 3. Used this dynamic membership rule as a workaround: (user.assignedPlans -any ((assignedPlan.service -match "NAME") -and (assignedPlan.capabilityStatus -eq "Enabled"))) (I found the ServicePlan names via Get-MsolAccountSku | Where-Object {$_.SkuPartNumber -eq “ENTERPRISEPREMIUM”} | ForEach-Object {$_.ServiceStatus} Thank you ina advance. Patrick :)163KViews0likes29CommentsMicrosoft Graph PowerShell SDK Module OneDrive Folder Permissions Assignment
As an M365 Global Admin, I have been tasked with creating a new folder in other users OneDrive root folder (Documents) we can call that folder 'myFolder', then I need to assign a Microsoft Azure Security group ('myGroup') to that folder with read/write permissions. I have a list of users (taking input from txt file of UPNs), and am able to loop through the users and create the folder, so step one is possible, but where I am failing is the assignment of the permissions, am using PowerShell 7 and the MS Graph PowerShell Mod, actually for the folder creation I used the API and invoke-method, but I am running into problems since OneDrive is on top of SharePoint, I am not sure how to accomplish this task. Any help would be greatly appreciated! Original Post: https://techcommunity.microsoft.com/t5/microsoft-365/microsoft-graph-powershell-sdk-module-onedrive-folder/m-p/3940795519Views0likes0CommentsThrottling issues when applying sensitivity labels via PowerShell
We need to apply a base sensitivity label for over 200 teams by following the scripts here: How to Apply Sensitivity Labels to Existing Teams (practical365.com) but after applying labels to 4 or 5 teams (groups), we're getting throttling errors. We've tried putting a 30-second delay between command executions, but it's not helping. Is there a better way to do this, other than to keep trying longer sleep times?641Views0likes0CommentsChange the default settings to hide Microsoft 365 Groups from the global address list.
Hi, How can I change the default settings for Microsoft 365 groups so when a new group gets created by default it doesn't appear in GAL? I don't want to do it per group so the below command doesn't fulfil what I'm looking for: Set-UnifiedGroup -Identity "Legal Department" -HiddenFromAddressListsEnabled $true Thanks14KViews0likes3CommentsHow to create O365 Groups in Powershell from a csv file
Hello, First I want to say that it's my irst post here, so I didn't know if I should post here or in the Powershell conversations. I'm struggling at the moment because I'm trying to massively create a few hundreds Office 365 groups for my organization, each with (possibly) multiple owners and members. I've got a list of the groups to create in a csv file, which looks like that: Name;Email;Members;Owners O365 Test Group Vincent;O365_TestGroup_vincent@xxx.fr;e-mail_of_member1, e-mail_of_member2;e-mail_of_owner1, e-mail_of_owner2 (of course in my actual script I have the actual e-mail addresses) My script looks like that: $Groups=Import-Csv "path to my csv file" -Header Name, Email, Members, Owners -Delimiter ";" | select -skip 1 foreach ($Group in $Groups){ $Name=$Group.Name $Mail=$Group.Email $Members=$Group.Members $Owner=$Group.Owners New-UnifiedGroup -DisplayName $Name -EmailAddresses $Mail -ManagedBy $Owner -Members $Members -AccessType Private -Language fr-FR -RequireSenderAuthenticationEnabled $false -SubscriptionEnabled -AutoSubscribeNewMembers } It seems that adding multiple members or owners in a variable from a text file does not work like that. It returns me this error (in French, but it says that "user1, user2" cannot be found) Désolé... Nous n’avons pas pu trouver le propriétaire «e-mail_of_owner1, e-mail_of_owner2», car nous avons rencontré l’erreur «L'objet "user1, user2" est introuvable. Assurez-vous que vous l'avez correctement tapé ou spécifiez un autre objet.». + CategoryInfo : NotSpecified: (:) [New-UnifiedGroup], GroupMailboxFai...eOwnerException + FullyQualifiedErrorId : [Server=MR2P264MB0033,RequestId=036653cc-558d-407c-9e71-84ce2c437b53,TimeStamp=26/10/2018 12:12:42] [FailureCategory=Cmdlet-GroupMailboxFailedToResolveOwnerException] 4C7DBAFB,Microsoft.Exchang e.Management.RecipientTasks.NewUnifiedGroup + PSComputerName : ps.outlook.com If I try without the import-csv part and I put multiple owners separated by a comma in my variable, it works, I can create one group like that (but that means 1 script for 1 group) So I don't really know how to do it with my list of groups in a text file. Can you help me with that please? Thanks in advance. Best regards, VincentSolved24KViews0likes5CommentsO365 Group Mailbox Reports?
I'm trying to compile a PS report that will show me the size of each group mailbox within my O365 Groups. Get-mailboxstatistics works for individual group mailboxes using the primarysmtpaddress, Identity, ID, etc., but I want to be able get them all using the Recipienttype, RecipienttypeDetails, or even MailboxtypeDetails (which shows as 'GroupMailbox' in the get-mailboxstatistics CMDLET). I've tried filtering by the above (where-object), and then piping to get-mailboxstatistics but get nothing. Despite looking, I haven't seen too much on this and I am anticipating a need for it for admin purposes. Thanks! It also made me wonder about how MS is going to approach these 'group mailboxes' from a licensing standpoint, esp since we're now required to assign an Exchange Plan 2 license to our shared/resource mailboxes.Solved12KViews0likes9CommentsPowerShell script to export Office 365 Groups Usage in CSV format used to Audit an Office 365 Tenant
After the previous scripts published to audit an Office 365 Tenant: https://techcommunity.microsoft.com/t5/SharePoint/PowerShell-script-to-export-SharePoint-Usage-in-CS... https://techcommunity.microsoft.com/t5/Microsoft-Stream-Forum/PowerShell-script-to-audit-and-export-... https://techcommunity.microsoft.com/t5/Office-365-Video/PowerShell-script-to-audit-and-export-all-co... https://techcommunity.microsoft.com/t5/Exchange/PowerShell-script-to-export-Exchange-Usage-in-CSV-fo... https://techcommunity.microsoft.com/t5/OneDrive-for-Business/PowerShell-script-to-export-OneDrive-Us... https://techcommunity.microsoft.com/t5/Microsoft-Teams/PowerShell-script-to-export-Microsoft-Teams-Usage-in-CSV-format/m-p/484713#M30563 This script is now dedicated to Office 365 Groups case. [string]$ReportPath = ".\Reports\" [string]$username = "Admin@yourtenant.onmicrosoft.com" [string]$PwdTXTPath = "C:\SECUREDPWD\ExportedPWD-$($username).txt" $secureStringPwd = ConvertTo-SecureString -string (Get-Content $PwdTXTPath) $adminCreds = New-Object System.Management.Automation.PSCredential $username, $secureStringPwd $UserCredential = $adminCreds #$userCredential = Get-Credential $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $session $AllExistingGroups = Get-UnifiedGroup -IncludeAllProperties | Select ExternalDirectoryObjectId,Id,ServerName,Name,DisplayName,Alias,EmailAddresses,PrimarySmtpAddress,SharePointSiteUrl,Notes,Language, ManagedBy,ManagedByDetails,AccessType,GroupType,AutoSubscribeNewMembers,GroupMemberCount,GroupExternalMemberCount,WhenCreatedUTC,WhenChangedUTC $datestring = (get-date).ToString("yyyyMMdd-hhmm") $fileName = Join-Path -Path $ReportPath -ChildPath $("O365-Groups_"+ $datestring + ".csv") Write-host " -----------------------------------------" -ForegroundColor Green Write-Host (" >>> writing to file {0}" -f $fileName) -ForegroundColor Green $AllExistingGroups | Export-csv $fileName -NoTypeInformation Write-host " -----------------------------------------" -ForegroundColor Green You can adapt that script as you need, based on your own requirements Fabrice Romelard French version: http://blogs.developpeur.org/fabrice69/archive/2019/04/26/office-365-script-powershell-pour-auditer-l-usage-des-office-groups-de-votre-tenant.aspx Source used: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2015/05/12/working-with-office-365-groups-using-powershell.aspx https://docs.microsoft.com/en-us/powershell/module/exchange/users-and-groups/get-unifiedgroup?view=exchange-ps4.8KViews0likes0CommentsSample Powershell to identify groups with HBI classification and have external users
Here's some sample PowerShell that will - Identify Office 365 Groups with a "HBI" classification and if there are Guest users within the group. - Identify the owners of the respective groups - Identify the specific guest users within each group This could be used in conjunction with Microsoft Flow to programmatically - automate the removal of guest users from groups with specific classifications - automate an email to the owners of the group to alert the presence of external (guest) users in an Office 365 Group - automate an email to the owners of the group to indicate the Office 365 Group is not compliant with guest access policy and then programmatically disable/remove external guests $Groups = Get-UnifiedGroup -Filter {GroupExternalMemberCount -gt 0} | Where-Object {$_.Classification -eq 'HBI'} $groups| Format-Table -AutoSize DisplayName, Classification, GroupMemberCount, GroupExternalMemberCount, Managedby ForEach ($G in $Groups) { $Ext = Get-UnifiedGroupLinks -Identity $G.Identity -LinkType Members ForEach ($E in $Ext) { If ($E.Name -match "#EXT#") { Write-Host "Group " $G.DisplayName "includes guest user" $E.Name } } }1.4KViews2likes0Comments