Msolservice - 将值从一个属性复制到另一个
Msolservice - copy value from one attribute to another
我在 Azure 中有大量用户,我需要将属性 Office 中的值复制到属性 State。如果 State 包含值而 Office 不包含,则必须清除 State。这两个属性之后必须完全相同。我必须使用 Powershell 和 MSonline/msolservice https://docs.microsoft.com/en-us/powershell/module/msonline/?view=azureadps-1.0
有什么建议吗?
你把逻辑说清楚了。
你需要做的是轮询所有用户并检查Office
和State
的两个属性。
一个简单的示例供您参考:
$users = Get-MsolUser
foreach($user in $users){
if ($user.Office -ne $null -and $user.Office -ne $user.State) {
Set-MsolUser -UserPrincipalName $user.UserPrincipalName -State $user.Office
}
if ($user.Office -eq $null -and $user.State -ne $null){
Set-MsolUser -UserPrincipalName $user.UserPrincipalName -State "$null"
}
}
我在 Azure 中有大量用户,我需要将属性 Office 中的值复制到属性 State。如果 State 包含值而 Office 不包含,则必须清除 State。这两个属性之后必须完全相同。我必须使用 Powershell 和 MSonline/msolservice https://docs.microsoft.com/en-us/powershell/module/msonline/?view=azureadps-1.0
有什么建议吗?
你把逻辑说清楚了。
你需要做的是轮询所有用户并检查Office
和State
的两个属性。
一个简单的示例供您参考:
$users = Get-MsolUser
foreach($user in $users){
if ($user.Office -ne $null -and $user.Office -ne $user.State) {
Set-MsolUser -UserPrincipalName $user.UserPrincipalName -State $user.Office
}
if ($user.Office -eq $null -and $user.State -ne $null){
Set-MsolUser -UserPrincipalName $user.UserPrincipalName -State "$null"
}
}