共用方式為


Set-MsolUser

修改 Azure Active Directory 中的使用者。

語法

Set-MsolUser
   [-ImmutableId <String>]
   [-ObjectId <Guid>]
   [-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>]
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

Set-MsolUser Cmdlet 會修改用戶物件。

僅針對基本屬性的更新使用此 Cmdlet。 使用 Set-MsolUserLicense、Set-MsolUserPasswordSet-MsolUserPrincipalName Cmdlet 更新使用者的授權、密碼和使用者主體名稱。

範例

範例 1:封鎖使用者的認證

PS C:\> Set-MsolUser -UserPrincipalName "davidchew@contoso.com" -BlockCredential $True

此命令會將封鎖認證設定為使用者$True,以封鎖他們無法登入。 無法對同步的使用者執行此動作。

範例 2:更新顯示名稱

PS C:\> Set-MsolUser -UserPrincipalName "davidchew@contoso.com" -DisplayName "David Chew" -Title "Manager" -Department "Finance"

此命令會更新指定使用者的顯示名稱。

範例 3:設定使用者的位置

PS C:\> Set-MsolUser -UserPrincipalName "davidchew@contoso.com" -UsageLocation "CA"

此命令會設定使用者的位置國家或地區。 國家或地區必須是兩個字母的 ISO 代碼。 這可以針對已同步的使用者以及受管理的使用者設定。

範例 4:設定慣用的數據位置

PS C:\> Set-MsolUser -UserPrincipalName "davidchew@contoso.com" -PreferredDataLocation "EUR"

此命令會將用戶主體名稱為 davidchew@contoso.com EUR的使用者慣用數據位置屬性。

參數

-AlternateEmailAddresses

指定使用者的替代電子郵件位址。

類型:String[]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-AlternateMobilePhones

指定使用者的替代行動電話號碼。

類型:String[]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-BlockCredential

指定使用者是否無法使用其使用者識別碼登入。

類型:Boolean
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-City

指定使用者的城市。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Country

指定用戶的國家或地區。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Department

指定用戶的部門。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-DisplayName

指定用戶的顯示名稱。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Fax

指定用戶的傳真編號。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-FirstName

指定使用者的名字。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ImmutableId

指定使用者同盟身分識別的不可變標識碼。 對於具有標準身分識別的使用者,應該省略此專案。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-LastName

指定使用者的姓氏。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-LastPasswordChangeTimestamp

指定上次變更密碼的時間。

類型:DateTime
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-MobilePhone

指定用戶的行動電話。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ObjectId

指定使用者的唯一物件識別碼。

類型:Guid
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Office

指定用戶辦公室的位置。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-PasswordNeverExpires

指定用戶密碼是否定期到期。

類型:Boolean
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-PhoneNumber

指定用戶的電話號碼。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-PostalCode

指定使用者的郵遞區號。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-PreferredDataLocation

指定使用者的慣用資料位置。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-PreferredLanguage

指定使用者的慣用語言。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-SoftDeletionTimestamp

指定虛刪除的時間。

類型:DateTime
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-State

指定使用者所在的州或省。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-StreetAddress

指定使用者的街道位址。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-StrongAuthenticationMethods

指定強式驗證方法的陣列。

類型:StrongAuthenticationMethod[]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-StrongAuthenticationRequirements

指定強式驗證需求的陣列。

類型:StrongAuthenticationRequirement[]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-StrongPasswordRequired

指定是否需要用戶的強密碼。

類型:Boolean
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-StsRefreshTokensValidFrom

指定 StsRefreshTokensValidFrom 值。

類型:DateTime
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-TenantId

指定要執行作業之租使用者的唯一標識符。 預設值是目前使用者的租使用者。 此參數僅適用於合作夥伴使用者。

類型:Guid
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Title

指定使用者的標題。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-UsageLocation

指定取用服務的使用者位置。 指定兩個字母的國家或地區代碼。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-UserPrincipalName

指定使用者的使用者識別碼。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-UserType

指定使用者類型。

類型:UserType
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False