Microsoft 365许可证全景分析:Powershellisfun用户许可报告工具详解
【免费下载链接】PowershellisfunRepository with the scripts that I have used in my blogs on https://powershellisfun.com. If you like these, please sponsor this project using the Sponsor button below or buy me a coffee :) https://www.buymeacoffee.com/powershellisfun项目地址: https://gitcode.com/gh_mirrors/po/Powershellisfun
Powershellisfun项目中的Microsoft 365许可证报告工具是一款基于PowerShell和Microsoft Graph的实用脚本,能够帮助管理员快速获取用户许可分配情况,实现企业许可资源的高效管理。该工具通过直观的CSV报告形式,让复杂的许可结构一目了然,是IT运维人员的必备效率工具。
🌟 核心功能:从混乱到清晰的许可管理
Microsoft 365许可体系包含众多SKU和服务计划,手动追踪用户分配情况既耗时又容易出错。Microsoft_365_License_Overview_per_user.ps1脚本通过以下功能解决这一痛点:
🔍 多维度筛选能力
支持三种精准筛选方式:
- 按许可SKU筛选:如
-FilterLicenseSKU 'Windows 10 Enterprise E3' - 按服务计划筛选:如
-FilterServicePlan 'Universal Print' - 按用户筛选:如
-FilterUser 'joe.smith'
📊 全面报告内容
生成的CSV报告包含关键信息:
- 用户UPN(User Principal Name)
- 许可SKU名称(友好名称)
- 服务计划名称(友好名称和内部名称)
- 应用范围(AppliesTo)
- 配置状态(ProvisioningStatus)
🚀 简单三步上手使用
1️⃣ 准备工作
确保系统已安装PowerShell 5.1或更高版本,并拥有Microsoft 365管理员权限。脚本会自动检查并安装所需的Microsoft Graph模块:
# 脚本自动处理模块安装 Microsoft.Graph.Identity.DirectoryManagement Microsoft.Graph.Users2️⃣ 执行基本命令
无需复杂参数即可生成完整报告:
.\Microsoft_365_License_Overview_per_user.ps13️⃣ 查看结果
脚本会自动生成CSV文件并在默认应用中打开,展示所有用户的许可分配情况。典型输出示例:
User;LicenseSKU;ServiceplanFriendly;ServiceplanInternal;AppliesTo;ProvisioningStatus user@contoso.com;Microsoft 365 E3;Exchange Online (Plan 2);EXCHANGE_S_ENTERPRISE;User;Success user@contoso.com;Microsoft 365 E3;SharePoint Online (Plan 2);SHAREPOINTENTERPRISE;User;Success💡 高级应用场景
🔎 精准定位许可问题
当某个服务无法使用时,可快速筛选特定用户的许可状态:
.\Microsoft_365_License_Overview_per_user.ps1 -FilterUser 'problem.user@contoso.com'📈 许可合规审计
定期执行以下命令,确保许可使用符合企业政策:
.\Microsoft_365_License_Overview_per_user.ps1 -FilterLicenseSKU 'Microsoft 365 E5'🚨 服务计划状态监控
跟踪特定服务的配置状态,及时发现异常:
.\Microsoft_365_License_Overview_per_user.ps1 -FilterServicePlan 'Teams'🛠️ 技术实现亮点
🔄 智能SKU映射
脚本自动从Microsoft Docs下载最新的SKU参考CSV,建立内部ID与友好名称的映射关系,确保报告可读性:
# 自动下载并处理SKU参考数据 [string]$csvLink = (Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/entra/identity/users/licensing-service-plan-reference').Links.href -match '\.csv$'⚡ 高效数据处理
采用流式处理用户数据,即使在大型租户中也能保持良好性能:
# 流式获取用户数据 $userQuery = @{ All = $true Property = @('id', 'userPrincipalName') } $users = Get-MgUser @userQuery📝 使用注意事项
- 权限要求:需要"Directory.Read.All"、"User.Read.All"和"Organization.Read.All"权限
- 网络连接:执行时需保持互联网连接,以便下载SKU参考数据
- 输出文件:默认生成临时CSV文件,建议执行后另存为永久报告
- 模块依赖:首次运行会自动安装Microsoft Graph模块,可能需要管理员权限
通过这款强大的许可报告工具,IT管理员可以告别繁琐的手动查询,轻松掌握企业Microsoft 365许可分配全景,为成本优化和合规审计提供有力支持。无论是日常管理还是深度分析,Powershellisfun的许可证报告工具都能成为您的得力助手。
要开始使用此工具,请克隆项目仓库:
git clone https://gitcode.com/gh_mirrors/po/Powershellisfun然后导航至"Microsoft 365 License Overview Per User"目录即可运行脚本。
【免费下载链接】PowershellisfunRepository with the scripts that I have used in my blogs on https://powershellisfun.com. If you like these, please sponsor this project using the Sponsor button below or buy me a coffee :) https://www.buymeacoffee.com/powershellisfun项目地址: https://gitcode.com/gh_mirrors/po/Powershellisfun
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考