ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

365Inspect报错排查手册:10种常见错误的原因与快速解决方案

365Inspect报错排查手册:10种常见错误的原因与快速解决方案 365Inspect报错排查手册10种常见错误的原因与快速解决方案【免费下载链接】365InspectA PowerShell script that automates the security assessment of Microsoft 365 environments.项目地址: https://gitcode.com/gh_mirrors/36/365Inspect365Inspect 是一款免费开源的 PowerShell 脚本工具可以自动化完成 Microsoft 365 租户的安全评估内置上百个检查器Inspector覆盖 Exchange、SharePoint、Teams、Entra ID 等服务的配置风险。很多新手第一次运行 365Inspect 时都会遇到报错——缺模块、版本冲突、权限不足、连接失败等。这份手册按「报错原文 → 原因 → 快速解决」逐一整理了 10 种最常见的 365Inspect 报错帮你快速定位并修复问题把安全评估跑通。 报错关键词快速定位表先找到终端里最先出现的红色报错对号入座报错关键词章节is not installed/Dependency checks failed错误2not work on a non-Windows operating system错误3Excluding SharePoint Inspectors错误3Connecting to … Failed错误5NOT MET - Some inspectors may fail错误7does not belong to the set错误8Directory not created错误9错误1缺少必填参数脚本拒绝执行症状Cannot process command because of one or more missing mandatory parameters: OutPath, UserPrincipalName.原因365Inspect.ps1将OutPath报告输出目录和UserPrincipalName评估账号的 UPN设为必填参数缺一不可。快速解决一次性提供三个核心参数.\365Inspect.ps1 -OutPath ..\365_report -UserPrincipalName myusermytenant.onmicrosoft.com -Auth MFA-Auth默认就是MFA可省略UserPrincipalName必须填实际执行评估的管理员账号。错误2模块未安装或 PowerShellGet 版本过低症状ExchangeOnlineManagement is not installed. Would you like to attempt installation now? (Y|N) Dependency checks failed. Please install all missing modules before running this script.或提示PowerShellGet is not the correct version。原因365Inspect 启动时会自动校验四个管理模块——ExchangeOnlineManagement≥2.0.5、Microsoft.Graph≥1.9.6、PnP.PowerShell、MicrosoftTeams≥4.4.1以及 PowerShellGet 2.2.5任一缺失都会导致依赖检查失败并直接退出。快速解决在管理员PowerShell 窗口中手动安装交互式安装容易因窗口权限不足而失败Install-Module -Name ExchangeOnlineManagement -AllowClobber -Force Install-Module -Name PnP.PowerShell -AllowClobber -Force Install-Module -Name Microsoft.Graph -AllowClobber -Force Install-Module -Name MicrosoftTeams -AllowClobber -Force Update-Module -Name PowerShellGet -Force安装完成后重新运行即可脚本会重新执行环境校验。错误3操作系统或 PowerShell 版本不满足要求症状Were sorry, due to various module dependency requirements, this tool will not work on a non-Windows operating system.或PnP.PowerShell module is not compatible with Windows PowerShell v5.1. … Excluding SharePoint Inspectors…原因PnP.PowerShell 等模块依赖 Windows 运行环境PnP.PowerShell 2.x 需要 PowerShell 7.2 及以上在 PowerShell 5.1 上只兼容 PnP.PowerShell ≤1.12.0。快速解决首选在 Windows 上安装 PowerShell 7.2 运行365Inspect 已兼容 PowerShell Core。若只能用 PowerShell 5.1保持 PnP.PowerShell 旧版本或接受提示——6 个 SharePoint 检查器会被自动排除不影响其他服务的评估。错误4模块版本不兼容Graph 与 ExchangeOnline 冲突症状环境校验通过但连接 Exchange Online 或执行相关检查时出现异常报错。原因Microsoft.Graph 与 Microsoft.Graph.Beta 的 2.23.0 版本和 ExchangeOnlineManagement 3.5.1 存在已知的不兼容问题README 中专门说明。快速解决改装经过验证的兼容版本组合Graph 2.21.1 EXO 3.5.0Install-Module -Name Microsoft.Graph -Scope CurrentUser -RequiredVersion 2.21.1 -AllowClobber -Force Install-Module -Name Microsoft.Graph.Beta -Scope CurrentUser -RequiredVersion 2.21.1 -AllowClobber -Force Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser -RequiredVersion 3.5.0 -AllowClobber -Force错误5服务连接失败Connecting to … Failed症状Connecting to Microsoft Graph Failed. Connecting to Security and Compliance Center Failed. Connecting to Exchange Online Failed. Connecting to SharePoint Service Failed. Connecting to Microsoft Teams Failed.每一条后面都会跟一段具体的异常信息。原因凭据或 UPN 错误、MFA 未完成、账号权限不足、网络不通或使用了-Auth ALREADY_AUTHED但当前窗口根本没有有效会话。快速解决确认账号同时拥有Global Administrator和SharePoint Administrator角色使用-Auth MFA时会依次弹出多个浏览器登录窗口Graph、合规中心、Exchange、SharePoint、Teams 各需登录一次这是正常行为逐个完成 MFA 即可使用-Auth ALREADY_AUTHED时必须先在同一个 PowerShell 窗口中手动登录过对应服务检查网络能否访问 login.microsoftonline.com、sharepoint.com 等域名国云/行业云租户记得加-Environment参数。 报错后面的异常信息往往比 Failed 本身更有价值优先阅读它。错误6PnP PowerShell 未注册应用SharePoint 连接失败症状运行到 SharePoint 环节时提示Please enter the Application/Client ID of the application created to replace PnP.Powershell输入 ID 后仍出现Connecting to SharePoint Service Failed.原因从 2024 年 9 月起PnP.PowerShell 要求租户管理员自行注册一个 Entra ID 应用SharePoint 连接必须携带正确的 Application/Client ID。快速解决按 README 中 PnP.PowerShell Module 一节注册应用并记住生成的 Application/Client ID运行时直接传入避免手工输入出错.\365Inspect.ps1 -OutPath ..\365_report -UserPrincipalName usertenant.onmicrosoft.com -Auth MFA -pnpPowerShellApplicationId 你的ClientID错误7管理员角色不足NOT MET症状[-] NOT MET - Some inspectors may fail!原因用户模式MFA/DEVICE 登录下当前账号必须同时拥有 Global Administrator 与 SharePoint Administrator 角色应用模式-Auth APP下服务主体至少需要 Global Administrator最低可放宽到 Global Reader此时会自动排除 Inspect-eDiscoveryAdmins需手动查询。快速解决在 Microsoft Entra 管理中心为账号/服务主体补上所需角色后重跑若无法升级权限可接受部分检查器跳过——报告开头会标注 ALL REQUIREMENTS MET 或 NOT MET 状态。错误8参数值不合法ValidateSet 校验报错症状The argument … does not belong to the set …原因三个参数有严格的取值范围且大小写敏感必须与下列值完全一致-AuthMFA/DEVICE/APP/ALREADY_AUTHED-EnvironmentDefault/USGovGCCHigh/USGovDoD/Germany/China-reportTypeAll/HTML/CSV/XML/JSON快速解决直接照抄上表取值不要自行改动大小写或拼写。错误9输出目录创建失败Directory not created症状Directory not created. Please check permissions. Press Enter to Exit原因当前用户对-OutPath指定的位置没有创建目录的权限。快速解决把OutPath指向当前用户可写的目录例如用户目录下的文件夹同时建议 365Inspect 安装目录仅由管理员可读写防止脚本被篡改。成功运行后输出目录中会生成Report_时间戳.html图形化报告含风险严重程度与风险分布图CSV / XML / JSON 报告、以及整个结果目录的 zip 压缩包Log目录存放执行过程中的错误日志 CSV 报告使用^作为分隔符请用文本编辑器打开再粘贴进 Excel直接双击打开会列错位。错误10Inspector 检查器模块报错用 Log 日志定位症状某个具体检查器执行时抛出红色错误README 称之为 loud and ugly error例如自定义的Inspectors/XXX.ps1运行失败。原因自定义或修改过的检查器不符合规范——最常见的是.ps1与.json文件名不一致或函数没有按约定返回字符串列表或$null。快速解决查日志到输出目录的Log目录下找ErrorLog_时间戳.log它由Write-ErrorLog.ps1自动写入包含错误时间、错误信息、失败脚本、失败行号与调用堆栈是定位问题最快的入口对模板参照Templates/Inspector-Template.ps1和Templates/Inspector-Template.json检查自己的检查器是否遵循「Try/Catch Write-ErrorLog 返回列表」的约定缩小范围用-SelectedInspectors 检查器1,检查器2只跑少数几个检查器隔离出出错的模块核对清单报告附录的 Executed Inspectors 表格列出了本次实际执行的所有检查器可确认哪些跑了、哪些被排除。✅ 排查总思路遇到 365Inspect 报错按这个顺序走基本都能解决先读第一条红色报错——90% 的问题在上面 10 种里对照本文对号入座再翻Log目录里的ErrorLog_时间戳.log看具体失败行和堆栈检查环境——Windows PowerShell 7.2、模块版本组合Graph 2.21.1 / EXO 3.5.0、管理员角色缩小范围——用-SelectedInspectors/-ExcludedInspectors单独验证可疑的检查器。按这套流程走绝大多数 365Inspect 报错都能在半小时内解决顺利生成你的 Microsoft 365 安全评估报告。【免费下载链接】365InspectA PowerShell script that automates the security assessment of Microsoft 365 environments.项目地址: https://gitcode.com/gh_mirrors/36/365Inspect创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表