为我写一个使用power shell一次性向5个o365账户添加许可的命令
时间: 2023-03-31 17:04:27 浏览: 54
可以使用以下命令向5个o365账户添加许可:
$UserList = "user1@domain.com", "user2@domain.com", "user3@domain.com", "user4@domain.com", "user5@domain.com"
ForEach ($User in $UserList) {
Set-MsolUserLicense -UserPrincipalName $User -AddLicenses "ENTERPRISEPACK"
}
请注意,此命令需要管理员权限才能运行。
相关问题
为我写一个使用power shell向两个o365账户添加许可的命令
可以使用以下命令向两个o365账户添加许可:
$Credential = Get-Credential
Connect-MsolService -Credential $Credential
$Account1 = "example1@contoso.com"
$Account2 = "example2@contoso.com"
$License = "ENTERPRISEPACK"
Set-MsolUserLicense -UserPrincipalName $Account1 -AddLicenses $License
Set-MsolUserLicense -UserPrincipalName $Account2 -AddLicenses $License
请注意,需要替换示例电子邮件地址和许可证名称以匹配您的环境。
为我写一个使用power shell分配邮箱许可证给用户的命令
Set-Mailbox -Identity 用户名 -ProhibitSendReceiveQuota 2GB -ProhibitSendQuota 1.5GB -IssueWarningQuota 1GB -UseDatabaseQuotaDefaults $false