【发布时间】:2020-07-10 06:48:32
【问题描述】:
我正在使用 Powershell 脚本将新用户添加到 O365 并分配多个许可证。但是,我现在正在尝试将新用户也添加到现有组中。
Powershell
Connect-MsolService -Credential $UserCredential
Import-Csv -Path "C:\Users\Jesse\Documents\Powershell\NewAccounts.csv" | foreach {New-MsolUser -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuIdEMS,$_.AccountSkuIdENTERPRISEPACK} | Export-Csv -Path "C:\Users\Jesse\Documents\Powershell\NewAccountResults.csv" -Verbose
.CSV
DisplayName,FirstName,LastName,UserPrincipalName,Usagelocation,AccountSkuIdEMS, AccountSkuIdENTERPRISEPACK
Test Jesse,Test,Jesse,test.jesse@(Tenant).nl,NL,(Tenant):EMS,(Tenant):ENTERPRISEPACK
我找到了以下代码,但不知道如何将它正确地实现到我现有的代码中。我想我还需要连接到新服务才能使用此 cmdlet。是否可以在单个脚本中切换连接?
Add-UnifiedGroupLinks -Identity "Azure AD Join" -LinkType Members -Links test.jesse@(tenant).nl
【问题讨论】:
标签: powershell azure-active-directory office365