ค้นหาเว็บไซต์

Get-MsolUser : คำว่า 'Get-MsolUser' ไม่ได้รับการยอมรับ


คุณกำลังพยายามจัดการผู้ใช้ Office 365 ด้วย PowerShell และได้รับข้อผิดพลาดนี้:

Get-MsolUser : The term 'Get-MsolUser' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ Get-MsolUser
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-MsolUser:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

ข้อผิดพลาดนี้เกิดจากการไม่ได้โหลดโมดูล MSOnline สำหรับ PowerShell ดังนั้นจึงไม่รู้จักคำสั่ง "Get-MsolUser"

(PowerShell 3.0 และเวอร์ชันที่ใหม่กว่าจะโหลดโมดูลที่จำเป็นโดยอัตโนมัติ ดังนั้นปัญหาอาจเป็นไปได้ว่าโมดูล MSOnline หายไปจากระบบของคุณ)

เมื่อต้องการแก้ไขปัญหานี้ ให้ติดตั้งโมดูล MSOnline โดยการเรียกใช้คำสั่งต่อไปนี้:

Install-Module MSOnline

(ตรวจสอบให้แน่ใจว่าได้เรียกใช้ในฐานะผู้ดูแลระบบ - อ่านเพิ่มเติมเกี่ยวกับลำดับการโหลดโมดูล PowerShell และการแก้ไขปัญหาขั้นสูงที่นี่)

หลังจากรันคำสั่งนี้ คุณอาจได้รับข้อความต่อไปนี้:

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

พิมพ์ Y แล้วกด Enter เพื่อดาวน์โหลดและติดตั้งโมดูล

จากนั้นคุณสามารถเชื่อมต่อกับผู้เช่าของคุณและเริ่มจัดการบัญชีผู้ใช้ Azure AD ของคุณ:

PS C:\> Connect-MsolService
PS C:\> Get-MsolUser -UserPrincipalName hans.c.orsted@azure.skrubbeltrang.com

UserPrincipalName                     DisplayName           isLicensed
-----------------                     -----------           ----------
hans.c.orsted@azure.skrubbeltrang.com Hans Christian Ørsted True

จัดการผู้ใช้ Office 365 และสิทธิ์การใช้งานโดยไม่มี PowerShell

หากคุณกำลังมองหาวิธีที่เร็วกว่าและมีประสิทธิภาพมากขึ้นในการจัดการผู้ใช้ ใบอนุญาต และกล่องจดหมาย Office 365 ของคุณ คุณควรดูที่ Easy365Manager

ด้วย Easy365Manager คุณสามารถจัดการผู้ใช้ Office 365 และกล่องจดหมายได้โดยตรงในคอนโซลการจัดการผู้ใช้และคอมพิวเตอร์ Active Directory

Easy365Manager เป็นสแนปอินที่ขยายคุณสมบัติผู้ใช้และกลุ่มใน AD Users & Computers

ดังที่เห็นที่นี่ ด้วย Easy365Manager คุณสามารถเข้าถึงโดยตรงและง่ายดายเพื่อกำหนดค่าสิทธิ์การใช้งาน Office 365 ของผู้ใช้ AD ของคุณจากเครื่องมือผู้ดูแลระบบ Active Directory ที่คุ้นเคย:

สำหรับรายการคุณสมบัติทั้งหมดใน Easy365Manager โปรดดูที่นี้

คุณสามารถดาวน์โหลดเวอร์ชันทดลองใช้งาน 30 วันที่มีฟังก์ชันเต็มรูปแบบได้ที่นี่

คำสั่ง PowerShell โมดูล MSOnline

หากคุณต้องการทราบว่าคำสั่งใดบ้างที่มีอยู่ในโมดูล MSOnline PowerShell ให้ใช้คำสั่งต่อไปนี้

PS C:\> (Get-Module -Name MSOnline).ExportedCommands | ft key

Key
---
Add-MsolAdministrativeUnitMember
Add-MsolForeignGroupToRole
Add-MsolGroupMember
Add-MsolRoleMember
Add-MsolScopedRoleMember
Confirm-MsolDomain
Confirm-MsolEmailVerifiedDomain
Connect-MsolService
Convert-MsolDomainToFederated
Convert-MsolDomainToStandard
Convert-MsolFederatedUser
Disable-MsolDevice
Enable-MsolDevice
Get-MsolAccountSku
Get-MsolAdministrativeUnit
Get-MsolAdministrativeUnitMember
Get-MsolCompanyAllowedDataLocation
Get-MsolCompanyInformation
Get-MsolContact
Get-MsolDevice
Get-MsolDeviceRegistrationServicePolicy
Get-MsolDirSyncConfiguration
Get-MsolDirSyncFeatures
Get-MsolDirSyncProvisioningError
Get-MsolDomain
Get-MsolDomainFederationSettings
Get-MsolDomainVerificationDns
Get-MsolFederationProperty
Get-MsolGroup
Get-MsolGroupMember
Get-MsolHasObjectsWithDirSyncProvisioningErrors
Get-MsolPartnerContract
Get-MsolPartnerInformation
Get-MsolPasswordPolicy
Get-MsolRole
Get-MsolRoleMember
Get-MsolScopedRoleMember
Get-MsolServicePrincipal
Get-MsolServicePrincipalCredential
Get-MsolSubscription
Get-MsolUser
Get-MsolUserByStrongAuthentication
Get-MsolUserRole
New-MsolAdministrativeUnit
New-MsolDomain
New-MsolFederatedDomain
New-MsolGroup
New-MsolLicenseOptions
New-MsolServicePrincipal
New-MsolServicePrincipalAddresses
New-MsolServicePrincipalCredential
New-MsolUser
New-MsolWellKnownGroup
Redo-MsolProvisionContact
Redo-MsolProvisionGroup
Redo-MsolProvisionUser
Remove-MsolAdministrativeUnit
Remove-MsolAdministrativeUnitMember
Remove-MsolApplicationPassword
Remove-MsolContact
Remove-MsolDevice
Remove-MsolDomain
Remove-MsolFederatedDomain
Remove-MsolForeignGroupFromRole
Remove-MsolGroup
Remove-MsolGroupMember
Remove-MsolRoleMember
Remove-MsolScopedRoleMember
Remove-MsolServicePrincipal
Remove-MsolServicePrincipalCredential
Remove-MsolUser
Reset-MsolStrongAuthenticationMethodByUpn
Restore-MsolUser
Set-MsolADFSContext
Set-MsolAdministrativeUnit
Set-MsolCompanyAllowedDataLocation
Set-MsolCompanyContactInformation
Set-MsolCompanyMultiNationalEnabled
Set-MsolCompanySecurityComplianceContactInformation
Set-MsolCompanySettings
Set-MsolDeviceRegistrationServicePolicy
Set-MsolDirSyncConfiguration
Set-MsolDirSyncEnabled
Set-MsolDirSyncFeature
Set-MsolDomain
Set-MsolDomainAuthentication
Set-MsolDomainFederationSettings
Set-MsolGroup
Set-MsolPartnerInformation
Set-MsolPasswordPolicy
Set-MsolServicePrincipal
Set-MsolUser
Set-MsolUserLicense
Set-MsolUserPassword
Set-MsolUserPrincipalName
Update-MsolFederatedDomain

บทความที่เกี่ยวข้อง