创建 MS Graph 或 powershell 脚本,将所有用户的“使用位置”更改为“CA”
我能够为一名用户执行此操作,但我想为所有用户执行此操作
$userId = '00000000000000'
$usageLocation = 'IN'
Update-MgUser -UserId $userId -Usagelocation $usageLocation
创建 MS Graph 或 powershell 脚本,将所有用户的“使用位置”更改为“CA”
要使用图形模块将用户使用位置更新为加拿大,您可以使用以下脚本:
脚本
Connect-MgGraph
# Get all users
$users = Get-MgUser -All
# Update the usage location for each user
foreach ($user in $users) {
Update-MgUser -UserId $user.Id -UsageLocation "CA"
}
上述脚本将连接到 Microsoft Graph,获取所有用户,然后将每个用户的使用位置更新为我的环境中的“CA”。
输出:
参考: