桌面分析日志收集器Desktop Analytics log collector

自 Configuration Manager 版本 1906 起,可使用 Configuration Manager 安装目录中的“DesktopAnalyticsLogsCollector.ps1” 工具来帮助对桌面分析设备注册问题进行故障排除。Starting in Configuration Manager version 1906, use the DesktopAnalyticsLogsCollector.ps1 tool from the Configuration Manager install directory to help troubleshoot Desktop Analytics device enrollment issues. 它会运行一些基本故障排除步骤,并将相关日志收集到单个工作目录中。It runs some basic troubleshooting steps and collects the relevant logs into a single working directory. 你可以与 Microsoft 支持部门共享此内容。You can share this content with Microsoft support.

必备条件Prerequisites

用法Usage

从 Configuration Manager 安装内容获取脚本: SMSSETUP\TOOLS\DesktopAnalyticsLogsCollector\DesktopAnalyticsLogsCollector.ps1Get the script from the Configuration Manager installation content: SMSSETUP\TOOLS\DesktopAnalyticsLogsCollector\DesktopAnalyticsLogsCollector.ps1

DesktopAnalyticsLogsCollector.ps1
    [-LogPath] <String>
    [-LogMode] <Int16>
    [-CollectNetTrace] <Int16>
    [-CollectUTCTrace] <Int16>

参数Parameters

-LogPath

指定一个本地或 UNC 路径以放置日志和其他输出文件。Specifies a local or UNC path to put the log and other output files.

Values:

  • 本地路径(最大长度 = 130),例如:c:\myfolderLocal path (maximum length = 130), for example: c:\myfolder

  • UNC 路径(最大长度 = 130),例如:\\myserver\myfolderUNC path (maximum length = 130), for example: \\myserver\myfolder

类型:字符串Type: String

位置:1Position: 1

默认值$Env:SystemDrive\M365AnalyticsLogs(当此参数为 Null、空或空格时,该脚本将在系统驱动器下创建“M365AnalyticsLogs”文件夹。)Default value: $Env:SystemDrive\M365AnalyticsLogs (When this parameter is null, empty, or white space, the script creates the M365AnalyticsLogs folder under the system drive.)

-LogMode

指定日志的详细级别。Specifies the verbose level of the logs.

Values:

  • 0:仅将脚本消息记录到 PowerShell 命令窗口。0: Log script messages to PowerShell command window only.

  • 1:在输出文件夹和 PowerShell 命令窗口下,将脚本消息记录到两个日志文件。1: Log script messages to both log file under the output folder and PowerShell command window.

  • 2:仅将脚本消息记录到输出文件夹下的日志文件。2: Log script messages to log file under the output folder only.

类型:Int16Type: Int16

位置:2Position: 2

默认值1(将脚本消息记录到日志文件和 PowerShell 命令窗口。)Default value: 1 (Log script messages to both log file and PowerShell command window.)

-CollectNetTrace

指定脚本是否收集网络跟踪。Specifies whether the script collects the network trace.

Values:

  • 0:不要启用网络跟踪。0: Don't enable the network trace.

  • 1(任何非零整数值):启用网络跟踪并收集结果。1 (any non-zero integer value): Enable network trace and collect results.

类型:Int16Type: Int16

位置:3Position: 3

默认值0(不要启用网络跟踪)Default value: 0 (Don't enable the network trace)

-CollectUTCTrace

指定脚本是否收集 Windows UTC 跟踪和运行连接诊断。Specifies whether the script collects the Windows UTC trace and run connectivity diagnosis.

Values:

  • 0:不要启用 UTC 跟踪或运行连接诊断。0: Don't enable the UTC trace or run connectivity diagnosis.

  • 1(任何非零整数值):启用 UTC 跟踪,运行连接诊断,并收集结果。1 (any non-zero integer value): Enable the UTC trace, run connectivity diagnosis, and collect results.

类型:Int16Type: Int16

位置:4Position: 4

默认值0(不要启用 UTC 跟踪或运行连接诊断)Default value: 0 (Don't enable the UTC trace or run connectivity diagnosis)

输出Output

此脚本在指定的路径下创建一个“工作文件夹” 。The script creates a working folder under the specified path. 例如,“M365AnalyticsLogs_yy_MM_dd_HH_mm_ss” 。For example, M365AnalyticsLogs_yy_MM_dd_HH_mm_ss. 它将其所有输出文件放入此工作文件夹中。It puts all its output files into this working folder.

如果要让脚本能够写入“日志文件” ,它将在工作文件夹中生成一个日志文件。If you enable the script to write to a log file, it generates one in the working folder. 例如,“M365AnalyticsLogs_ yy_MM_dd_HH_mm_ss.txt” 。For example, M365AnalyticsLogs_ yy_MM_dd_HH_mm_ss.txt.

该脚本还会在工作文件夹中生成其他“诊断文件” 。The script also generates other diagnostic files in the working folder. 例如:For example:

  • installedKBs.txt:安装在设备上的 Windows 更新列表installedKBs.txt: a list of Windows updates installed on the device
  • appcompat:应用程序兼容性数据appcompat: application compatibility data
  • Reg*.txt:一系列文件,其中包含从 Windows 注册表导出的数据Reg*.txt: a series of files with exported data from the Windows Registry

示例Examples

示例 1:通过具有默认值的 PowerShell 命令窗口运行脚本Example 1: Run script via PowerShell command window with default values

.\DesktopAnalyticsLogsCollector.ps1

示例 2:通过具有指定参数的 PowerShell 命令窗口运行脚本Example 2: Run script via PowerShell command window with specified parameters

.\DesktopAnalyticsLogsCollector.ps1 -LogPath "c:\testABC" -LogMode 0 -CollectNetTrace 0 -CollectUTCTrace 0

示例 3:通过在适当位置具有指定参数的 PowerShell 命令窗口运行脚本Example 3: Run script via PowerShell command window with specified parameters in position

.\DesktopAnalyticsLogsCollector.ps1 "c:\testABC" 2 0 0

示例 4:通过具有指定参数和详细消息的 PowerShell 命令窗口运行脚本Example 4: Run script via PowerShell command window with specified parameter and verbose messages

.\DesktopAnalyticsLogsCollector.ps1 -LogMode 1 -Verbose

示例 5:通过 Configuration Manager“脚本” 部署脚本Example 5: Deploy script via Configuration Manager Scripts

有关详细信息,请参阅从 Configuration Manager 控制台创建并运行 PowerShell 脚本For more information, see Create and run PowerShell scripts from the Configuration Manager console.

DesktopAnalyticsLogsCollector.ps1 由 Microsoft 进行数字签名。DesktopAnalyticsLogsCollector.ps1 is digitally signed by Microsoft. 可能需要将其 Microsoft 代码签名证书作为受信任的发布者添加到目标设备上。You may need to add its Microsoft code signing certificate as a Trusted Publisher on the target device.

  1. 在 Windows 资源管理器中打开该脚本的属性。Open the properties of the script in Windows Explorer. 切换到“数字签名” 选项卡,然后选择“详细信息” 。Switch to the Digital Signatures tab and select Details.

  2. 在“常规” 选项卡上,选择“查看证书” 。On the General tab, select View Certificate.

    备注

    若要通过其他机制分发证书,请首先将证书导出到文件。To distribute the certificate via other mechanisms, first export the certificate to a file. 转到“详细信息” 选项卡,然后选择“复制到文件” 。Go to the Details tab, and select Copy to File.

  3. 选择“安装证书” 。Select Install Certificate. 导入此证书,将其置于“受信任的发布者” 商店。Import the certificate, placing it in the Trusted Publishers store.

另请参阅See also