New-MsolUser - สร้างบัญชีผู้ใช้ใหม่ใน Office 365
New-MsolUser cmdlet ใน PowerShell สร้างบัญชีผู้ใช้ใหม่ใน Microsoft Office 365
ไวยากรณ์ในการเพิ่มบัญชีผู้ใช้ใหม่ใน Azure Active Directory มีดังต่อไปนี้
New-MsolUser
[-ImmutableId <String>]
[-UserPrincipalName <String>]
[-BlockCredential <Boolean>]
[-City <String>]
[-Country <String>]
[-Department <String>]
[-DisplayName <String>]
[-Fax <String>]
[-FirstName <String>]
[-LastName <String>]
[-LastPasswordChangeTimestamp <DateTime>]
[-MobilePhone <String>]
[-Office <String>]
[-PasswordNeverExpires <Boolean>]
[-PhoneNumber <String>]
[-PostalCode <String>]
[-PreferredDataLocation <String>]
[-PreferredLanguage <String>]
[-SoftDeletionTimestamp <DateTime>]
[-State <String>]
[-StreetAddress <String>]
[-StrongPasswordRequired <Boolean>]
[-Title <String>]
[-UsageLocation <String>]
[-AlternateEmailAddresses <String[]>]
[-StrongAuthenticationMethods <StrongAuthenticationMethod[]>]
[-AlternateMobilePhones <String[]>]
[-StrongAuthenticationRequirements <StrongAuthenticationRequirement[]>]
[-StsRefreshTokensValidFrom <DateTime>]
[-UserType <UserType>]
[-Password <String>]
[-LicenseOptions <LicenseOption[]>]
[-ForceChangePassword <Boolean>]
[-LicenseAssignment <String[]>]
[-TenantId <Guid>]
[<CommonParameters>]ในบทความนี้ เราจะพูดถึงวิธีใช้ New-MsolUser cmdlet ใน PowerShell เพื่อสร้างบัญชีผู้ใช้ใหม่ใน Office 365 และมอบหมายใบอนุญาตให้กับผู้ใช้
วิธีสร้างผู้ใช้ใหม่ใน Office 365 ด้วย PowerShell
หากต้องการสร้างบัญชีผู้ใช้ใหม่ใน Office 365 ด้วย PowerShell ให้ใช้ New-MsolUser cmdlet
New-MsolUser -UserPrincipalName "[email " -DisplayName "Bob Allen" -FirstName "Bob" -LastName "Allen" -UsageLocation "US"คำสั่งนี้จะสร้างผู้ใช้ใหม่ด้วยชื่อที่แสดง “Bob Allen“ รหัสผ่านแบบสุ่มจะถูกสร้างขึ้นสำหรับผู้ใช้
ผลลัพธ์ของ cmdlet New-MsolUser มีคุณสมบัติดังต่อไปนี้
- รหัสผ่าน: New-MsolUser cmdlet สร้างรหัสผ่านแบบสุ่มสำหรับผู้ใช้
- UserPrincipalName: ชื่อหลักของผู้ใช้ที่ไม่ซ้ำของผู้ใช้
- ชื่อที่แสดง: ชื่อที่แสดงของผู้ใช้
- isLicensed: ระบุว่ามีการกำหนดใบอนุญาตให้กับผู้ใช้หรือไม่
พารามิเตอร์ -LicenseAssignment เลิกใช้แล้ว หากคุณพยายามมอบหมายใบอนุญาตให้กับผู้ใช้ด้วย New-MsolUser cmdlet คุณจะได้รับคำเตือนและข้อความแสดงข้อผิดพลาดต่อไปนี้
คำเตือน: cmdlet สิทธิ์การใช้งานนี้ถูกยกเลิกแล้ว โปรดอัปเดตเป็น MS Graph Set-MgUserLicense: https://aka.ms/mguserlicense
PS C:\> New-MsolUser -UserPrincipalName "[email " -DisplayName "Bob Allen" -FirstName "Bob" -LastName "Allen" -UsageLocation "US" -LicenseAssignment "shellgeeklab:ENTERPRISEPACK"
WARNING: This licensing cmdlet has been retired. Please update to MS Graph Set-MgUserLicense: https://aka.ms/mguserlicense
New-MsolUser : Unknown error occurred.
At line:1 char:1
+ New-MsolUser -UserPrincipalName "[email ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [New-MsolUser], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.OperationNotAllowedException,Microsoft.Online.Admi
nistration.Automation.NewUserวิธีสร้างผู้ใช้และกำหนดตำแหน่งข้อมูลที่ต้องการ
หากต้องการสร้างผู้ใช้และกำหนดตำแหน่งข้อมูลที่ต้องการใน Office 365 ให้ใช้ New-MsolUser cmdlet ใน PowerShell
New-MsolUser -UserPrincipalName "[email " -DisplayName "Peter Arthur" -FirstName "Peter" -LastName "Arthur" -PreferredDataLocation "EUR" คำสั่งนี้จะสร้างผู้ใช้ที่มีชื่อหลักของผู้ใช้ “[email “ ชื่อที่แสดงคือ “Peter Arthur ” และตำแหน่งข้อมูลที่ต้องการคือ “EUR “.
New-MsolUser cmdlet ใน PowerShell จะสร้างรหัสผ่านแบบสุ่มและกำหนดให้กับผู้ใช้
ผลลัพธ์ของคำสั่งดังกล่าวได้รับด้านล่าง
PS C:\> New-MsolUser -UserPrincipalName "[email " -DisplayName "Peter Arthur" -FirstName "Peter" -LastName "Arthur" -PreferredDataLocation "EUR"
Password UserPrincipalName DisplayName isLicensed
-------- ----------------- ----------- ----------
Waz60363 [email Peter Arthur False
PS C:\> บทสรุป
ฉันหวังว่าบทความข้างต้นเกี่ยวกับวิธีใช้ New-MsolUser cmdlet ใน PowerShell เพื่อสร้างผู้ใช้ใหม่และกำหนดคุณสมบัติให้กับเขาใน Office 365 จะเป็นประโยชน์สำหรับคุณ
คุณสามารถค้นหาหัวข้อเพิ่มเติมเกี่ยวกับคำสั่ง PowerShell Active Directory และพื้นฐานของ PowerShell ได้ในหน้าแรกของ ShellGeek
ลิงก์ที่เกี่ยวข้อง
รับ MsolUser
ชุด-MsolUser
เอา-MsolUser
คืนค่า-MsolUser
