Closed htsid5 closed 1 year ago
Same answer as I gave to the same question on Office365itpros.com:
Instead of fetching all Teams to report, use another method to report just selected teams. For example, you could apply a filter to find specific teams, or you could read in the details of teams to report from a CSV file. It’s really up to you. The report operates on whatever teams it’s given to process.
I am searching your script but not finding way of importing from CSV. To get full report and search for Teams is the problem as 10000 teams are hard to process and script is ending abruptly.
I was able to run it once but then i found that many teams are missing owner but they have owner.
The missing owner issue was dealt with in a fix in the latest version.
You'll have to write the code to import from a CSV file using the Import-CSV cmdlet. Create the CSV file, populate it with the information needed to find a team like its id, displayname, etc, and import it instead of getting the team data from the Graph.
I am using V5.8 15-Sep-2022 Improved check for groups with no owners, but it is not adding owner and saying No Owner Found in CSV.
Well, it's PowerShell, so how about doing some debugging? I can't see the data in your tenant, so you'll have to run the code and see what's returned when the script processes this code for a group that has owners that the script thinks has no owners. When you get this information, let me know and I will have a look. The code works OK here.
$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "/owners?" [array]$GroupData = Get-GraphData -Uri $Uri -AccessToken $Token If ($GroupData[0].'@odata.type' -eq '#microsoft.graph.user') { # Found a group owner, so extract names $OwnerNames = $GroupData.DisplayName -join ", " $GroupOwnerEmail = $GroupData[0].Mail } Else { # ownerless group $OwnerNames = "No owners found" $GroupOwnerMail = $Null }
I ran the code this morning and found 12 groups of 232 reported with no owners. This was because an account that used to be the sole owner of these groups had been deleted.
To check the accuracy of the report, find the group in the $Groups array. For example:
$Group = $Groups | ? {$_.Displayname -eq "Mail filter patent"}
Now check what Exchange Online says about the ownership:
get-unifiedgrouplinks -LinkType Owner -Identity $Group.id
If this cmdlet returns an owner (or owners), we have a problem, and I am interested. So far, I haven't found a situation where a group is misreported. If you do find one, please let me know the details of the group by running these commands:
$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "/owners?" [array]$GroupData = Get-GraphData -Uri $Uri -AccessToken $Token $Groupdata
What's in $GroupData?
Get-unifiedgroup links is getting me owner but CSV has no owner.
Running this
$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "/owners?" [array]$GroupData = Get-GraphData -Uri $Uri -AccessToken $Token $Groupdata
is not working because even if i try to run function of token, it is not helping. If you can kindly paste the the code which is getting Token as well. It gives me error:
The term 'Get-GraphData' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was include.....
The code to get the token is in the script.
Tony Redmond (from a mobile device)
From: htsid5 @.> Sent: Tuesday, October 11, 2022 2:23:09 PM To: 12Knocksinna/Office365itpros @.> Cc: 12 Knocksinna (Gmail) @.>; State change @.> Subject: Re: [12Knocksinna/Office365itpros] Report for Specific Teams (Issue #63)
Get-unifiedgroup links is getting me owner but CSV has no owner.
Running this
$Uri = "https://graph.microsoft.com/v1.0/groups/https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C41f75d3f3cfb411967d408daab8bbf98%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010913984375103%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=JHQ9dj4vSWaXmm78nGlzgU5pGnnAwkRMR0klK4%2BLEwM%3D&reserved=0" + $Group.Id + "/owners?" [array]$GroupData = Get-GraphData -Uri $Uri -AccessToken $Token $Groupdata
is not working because even if i try to run function of token, it is not helping. If you can kindly paste the the code which is getting Token as well.
— Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F12Knocksinna%2FOffice365itpros%2Fissues%2F63%23issuecomment-1274680650&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C41f75d3f3cfb411967d408daab8bbf98%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010913984375103%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=Yh94nVJTZ5N5KaOx7%2B443tX4VsZQ%2FtetUwcuNvbPyCk%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK45CISHHRHI4F63FRGTOYLWCVS33ANCNFSM6AAAAAAQ752S7A&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C41f75d3f3cfb411967d408daab8bbf98%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010913984375103%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=8kA7xQLhIZO6SzM85ae76PrJEsvhB6o8IQ%2B%2BSvYXtwQ%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>
$GroupData has name of 2 owners. myself and one another.
Can you paste the contents of $GroupData | FL
Tony Redmond (from a mobile device)
From: htsid5 @.> Sent: Tuesday, October 11, 2022 2:54:28 PM To: 12Knocksinna/Office365itpros @.> Cc: 12 Knocksinna (Gmail) @.>; State change @.> Subject: Re: [12Knocksinna/Office365itpros] Report for Specific Teams (Issue #63)
$GroupData has name of 2 owners. myself and one another.
— Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F12Knocksinna%2FOffice365itpros%2Fissues%2F63%23issuecomment-1274725831&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7Cd8e9a9b1900148a1c0d608daab901ee6%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010932753192493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=xPrCnpGsvuDzj6UlcUOevoGOYUZzClVyWMx5va%2B9hRM%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK45CISI7BBM5F2AHUEPQ7TWCVWRJANCNFSM6AAAAAAQ752S7A&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7Cd8e9a9b1900148a1c0d608daab901ee6%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010932753192493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=W1DZVvpTFQl4GNrGBToJFr%2B7q%2B09o5ewFYOV8hJADnQ%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>
Can i send privately for privacy reasons?
Just edit the email addresses and replace them with something like @.***
Tony Redmond (from a mobile device)
From: htsid5 @.> Sent: Tuesday, October 11, 2022 3:25:25 PM To: 12Knocksinna/Office365itpros @.> Cc: 12 Knocksinna (Gmail) @.>; State change @.> Subject: Re: [12Knocksinna/Office365itpros] Report for Specific Teams (Issue #63)
Can i send privately for privacy reasons?
— Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F12Knocksinna%2FOffice365itpros%2Fissues%2F63%23issuecomment-1274779018&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7Cc00479b08cf348d47a8208daab947245%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010951320639348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=i3xNvWVL%2Bj380CVr%2BFHxXeh5NMoTi%2BssCNXekxq90%2Fw%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK45CIWSXKMYH6SXRPYNMN3WCV2FLANCNFSM6AAAAAAQ752S7A&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7Cc00479b08cf348d47a8208daab947245%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010951320639348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=vv6wLFTFwuJDVvhpqOFfB4Unnztqo2xDFKXICK8pnXE%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>
PS C:\Users\hsiddiqui-admin> $Groupdata | fl
@odata.type : #microsoft.graph.user id : 37f4cad0-8d7f-4c81-9c65-**** businessPhones : {+1 ****} displayName : Siddiqui, Hasan givenName : Hasan jobTitle : **** mail : hsid****@**** mobilePhone : +1 **** officeLocation : **** preferredLanguage : surname : Siddiqui userPrincipalName : hsid****@****
@odata.type : #microsoft.graph.user id : 191c40ae-00d2-4b49-8216-**** businessPhones : {+1 ****} displayName : Eye, Philip givenName : Philip jobTitle : **** mail : ****@**** mobilePhone : +1 **** officeLocation : **** preferredLanguage : surname : Eye userPrincipalName : ****@****
And this group returns no owners in the output report?
Tony Redmond (from a mobile device)
From: htsid5 @.> Sent: Tuesday, October 11, 2022 3:44:34 PM To: 12Knocksinna/Office365itpros @.> Cc: 12 Knocksinna (Gmail) @.>; State change @.> Subject: Re: [12Knocksinna/Office365itpros] Report for Specific Teams (Issue #63)
PS C:\Users\hsiddiqui-admin> $Groupdata | fl
@odata.type : #microsoft.graph.user id : 37f4cad0-8d7f-4c81-9c65-**** businessPhones : {+1 } displayName : Siddiqui, Hasan givenName : Hasan jobTitle : **** mail : hsid@**** mobilePhone : +1 **** officeLocation : **** preferredLanguage : surname : Siddiqui userPrincipalName : hsid****@****
@odata.type : #microsoft.graph.user id : 191c40ae-00d2-4b49-8216-**** businessPhones : {+1 ****} displayName : Eye, Philip givenName : Philip jobTitle : **** mail : @ mobilePhone : +1 **** officeLocation : **** preferredLanguage : surname : Eye userPrincipalName : @
— Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F12Knocksinna%2FOffice365itpros%2Fissues%2F63%23issuecomment-1274814141&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C58859289280445f4bbe408daab971eec%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010962821700829%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=eBihIS7ptTl%2FUGkLKKMa4t0Sjrr89reSmEqAlEJzpXU%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK45CIRZOKPYEYGASUGFHODWCV4NFANCNFSM6AAAAAAQ752S7A&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C58859289280445f4bbe408daab971eec%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010962821700829%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=nYaAzLrHNuTOp3QYlFLlnPhFSqSWteUAmXklNBgFoMc%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>
Yes, i wish i can show you screenshot or attach it. but here you go
GroupName | ManagedBy | ContactEmail | Visibility | Members | External Guests | Description | Sensitivity Label | Team Enabled | Last Teams message | Number Teams messages | Last Email Inbox | Number Email Inbox |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Hasan Teams 8/24/2022 | No owners found | FALSE | N/A | 0 | 8/24/2022 14:46 | 1 | ||||||
Hasan Teams Group 04162020 | No owners found | FALSE | N/A | 0 | 2/15/2022 18:34 | 12 | ||||||
Hasan Teams Group 06102021 | No owners found | FALSE | N/A | 0 | 6/10/2021 16:03 | 1 | ||||||
Hasan Teams Group 07072021 | No owners found | FALSE | N/A | 0 | 7/7/2021 17:25 | 1 |
Also the script end report looks like not correct. I have many teams-enabled groups. Took 8 hours to process 10000 groups:
Number of Microsoft 365 Groups scanned: 10731 Potentially obsolete groups (based on document library activity: 10007 Potentially obsolete groups (based on conversation activity): 8186 Number of Teams-enabled groups: 1 Number of archived teams: 0 Percentage of Teams-enabled groups: 0.01%
Total Elapsed time: 44923.62 seconds
I’d expect the report to take a long time to run for that many groups. You could run it as an Azure Automatan scheduled runbook if you didn’t want to look at it running. Some alternation to the code would be needed, but not too extensive.
Tony Redmond (from a mobile device)
From: htsid5 @.> Sent: Tuesday, October 11, 2022 4:03:28 PM To: 12Knocksinna/Office365itpros @.> Cc: 12 Knocksinna (Gmail) @.>; State change @.> Subject: Re: [12Knocksinna/Office365itpros] Report for Specific Teams (Issue #63)
Also the script end report looks misleading as well. Took 8 hours to process 10000 groups:
Results - Teams and Microsoft 365 Groups Activity Report V5.8
Number of Microsoft 365 Groups scanned: 10731 Potentially obsolete groups (based on document library activity: 10007 Potentially obsolete groups (based on conversation activity): 8186 Number of Teams-enabled groups: 1 Number of archived teams: 0 Percentage of Teams-enabled groups: 0.01%
Total Elapsed time: 44923.62 seconds
— Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F12Knocksinna%2FOffice365itpros%2Fissues%2F63%23issuecomment-1274843502&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C85ca9b78be174c60634008daab99c412%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010974181836227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=7zMpvNrzFLT7rR5dYKfUApkFKYz6PQNAy2Ucyo82P78%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK45CIUAH7C7TQR5KGPJTELWCV6UBANCNFSM6AAAAAAQ752S7A&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C85ca9b78be174c60634008daab99c412%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010974181836227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=lUObk2FUUyxG2XPxpGyqP5OCiXV5%2BsBBnHo7Lh9%2BX6s%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>
Timing is not an issue as I understand 10k groups are a lot, at least it is not abruptly ending or crashing.
Problem is no owner
I am puzzled. The Graph reports two owners so the code check should be happy with that. I don’t see a problem in my tenant. There’s something odd that I can’t quite figure out.
But this is PowerShell, so feel free to do some debugging yourself. This is not a product. Anyone can update the code.
Tony Redmond (from a mobile device)
From: htsid5 @.> Sent: Tuesday, October 11, 2022 4:15:53 PM To: 12Knocksinna/Office365itpros @.> Cc: 12 Knocksinna (Gmail) @.>; State change @.> Subject: Re: [12Knocksinna/Office365itpros] Report for Specific Teams (Issue #63)
Timing is not an issue as I understand 10k groups are a lot, at least it is not abruptly ending or crashing.
Problem is no owner
— Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F12Knocksinna%2FOffice365itpros%2Fissues%2F63%23issuecomment-1274861659&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C20728c0fdb884bb5bc3508daab9b7ef2%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010981613026075%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=rVTMBBjEAISDuOnPBU7%2FZG%2B4HRLmzDnl%2F7UBptT2Fes%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK45CISDGKRI2LPIIB2A42LWCWACTANCNFSM6AAAAAAQ752S7A&data=05%7C01%7Ctony.redmond%40redmondassociates.org%7C20728c0fdb884bb5bc3508daab9b7ef2%7Cb662313f14fc43a29a7ad2e27f4f3478%7C0%7C0%7C638010981613026075%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C7000%7C%7C%7C&sdata=ymB0NgJz89JC%2FJ1Tz3sCRl9VmFStiimgoxY5OE9j%2FcQ%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>
Another thing i noticed is all of no owner ones which have owners, they have Overall Result either Issues or Fail.
also what i noticed is, teams stats are missing completely. Every group, it is saying Teams Enabled is False. That is why teams last message and number of teams message is missing data.
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
Team Enabled | Last Teams message | Number Teams messages -- | -- | --
I have 10K teams, i want to get report of just 100 teams. How I can achieve it?