简体   繁体   English

如何使用 Get-MgReportTeamUserActivityUserDetail Graph Powershell 命令?

[英]How do I use the Get-MgReportTeamUserActivityUserDetail Graph Powershell command?

I'm trying to work out how I can automate some Teams activity reports using the Get-MgReportTeamUserActivityUserDetail PowerShell Graph SDK cmdlet我正在尝试弄清楚如何使用 Get-MgReportTeamUserActivityUserDetail PowerShell Graph SDK cmdlet 自动生成一些 Teams 活动报告

https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.reports/get-mgreportteamuseractivityuserdetail?view=graph-powershell-1.0 https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.reports/get-mgreportteamuseractivityuserdetail?view=graph-powershell-1.0

I'm stumped on a couple of things我对几件事感到困惑

  1. When I just try to run it locally to validate it works I get errors with the -OutFile parameter.当我只是尝试在本地运行它以验证它是否有效时,我收到了 -OutFile 参数的错误。 I was (probably naively) assuming I'd just need to provide a local file path to where I wanted the report saved to?我(可能天真地)假设我只需要提供一个本地文件路径到我希望将报告保存到的位置? When I run it, I get an error that the filepath cannot be found.当我运行它时,出现找不到文件路径的错误。 I assumed it would create it for me as part of the process?我以为它会在这个过程中为我创建它? I did try creating a blank file with the same name but got the same error我确实尝试创建一个具有相同名称的空白文件但得到了相同的错误

How should I be using the -OutFile parameter?我应该如何使用 -OutFile 参数?

The basic command I'm running is this (creds left blank intentionally....)我正在运行的基本命令是这个(creds 故意留空....)

Import-Module Microsoft.Graph.Reports

$Cert = "xxx"
$ClientID = "xxx"
$TenantID = "xxx"

Connect-MgGraph -ClientID $ClientID -TenantID $TenantID -CertificateThumbprint $Cert

Get-MgReportTeamUserActivityUserDetail -Period "D7" -Outfile "c:\users\x\documents\x.csv"

Thoughts?想法?

I'd then want to get this into an automation runbook to grab the report on a set basis but am getting stuck well before that?: :)然后我想把它放到一个自动化运行手册中,以便在设定的基础上获取报告,但在那之前我就卡住了?::)

I ran a similar command and it worked as expected.我运行了一个类似的命令,它按预期工作。

The command expects you to pass the path that already exists and not the file, the file name you specify here would be automatically created.该命令希望您传递已存在的路径而不是文件,您在此处指定的文件名将自动创建。 if the file already exists then it will override.如果文件已经存在,那么它将覆盖。

Lastly, make sure the environment you are running has the appropriate permissions like read and write the directory in which you are trying to save the file最后,确保您正在运行的环境具有适当的权限,例如读取和写入您尝试保存文件的目录

Get-MgReportTeamUserActivityUserDetail -Period "D7" -Outfile "C:\Users\myname\Documents\testx.csv" Get-MgReportTeamUserActivityUserDetail -Period "D7" -Outfile "C:\Users\myname\Documents\testx.csv"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 powershell 中使用 Microsoft Graph .NET SDK? - How can i use Microsoft Graph .NET SDK in powershell? 如何使用 New-MgGroupOwnerByRef / Microsoft Graph PowerShell 模块 1.1.0 添加组所有者? - How do I add a group owner with New-MgGroupOwnerByRef / Microsoft Graph PowerShell module 1.1.0? 如何从 microsoft graph 获取刷新令牌 - How do I get refresh token from microsoft graph 如何使用 Microsoft graph 获取 SharePoint 库中的文档数? - How do I get the number of documents in a SharePoint library with Microsoft graph? 如何从标题中获取可用的电子邮件参考 ID 以在 Microsoft Graph 查询中使用? - How do I get a usable email message reference id from headers to use in a Microsoft Graph query? 如何使用命令 New-MgRoleManagementDirectoryRoleAssignment? - How do I use the command New-MgRoleManagementDirectoryRoleAssignment? 我如何在反应中使用 MS 图形 API? - How do i use the MS graph api in react? 如何使用 Microsoft Graph API 通过 appId 获取应用程序 - How can I use Microsoft Graph API to get Application by appId 如何向 Microsoft Graph Api 发布 GET 请求? - How do I post a GET Request to Microsoft Graph Api? 如何在 MS Graph C# 中获取所有团队? - How do I get all Teams in MS Graph C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM