Get-SPUser
傳回使用者帳戶或符合特定搜尋準則的帳戶。
語法
Get-SPUser
[[-Identity] <SPUserPipeBind>]
-Web <SPWebPipeBind>
[-AssignmentCollection <SPAssignmentCollection>]
[-Group <SPGroupPipeBind>]
[-Limit <String>]
[<CommonParameters>]
Description
Get-SPUser 指令程式會傳回所有符合 Identity、Web 或 Group 參數所提供之範圍的 SharePoint 使用者帳戶。
Identity 參數可以使用使用者的別名以傳回確切的相符項。
如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet。
範例
------------------範例 1------------------
Get-SPUser -Web 'https://sharepoint.contoso.com' -Group 'Viewers'
此範例會傳回網站上 https://sharepoint.contoso.com
SharePoint 群組檢視者的所有成員。
------------------範例 2------------------
Get-SPUser -Identity 'i:0#.w|contoso\jdoe' -Web 'https://sharepoint.contoso.com'
此範例會傳回透過網站上 https://sharepoint.contoso.com
的 Windows 宣告識別的特定使用者。
------------------範例 3------------------
Get-SPUser -Identity 'contoso\jdoe' -Web 'https://sharepoint.contoso.com'
此範例會傳回透過網站 上傳統 Windows 驗證 識別的特定使用者https://sharepoint.contoso.com
。
參數
-AssignmentCollection
管理物件以適當處置它們。 使用 SPWeb 或 SPSite 等物件可能會耗用大量的記憶體,因此在 Windows PowerShell 指令碼中使用這些物件時,必須適當地管理記憶體。 您可以使用 SPAssignment 物件將物件指派給變數,並在不需要時處置這些物件,以釋放記憶體。 使用 SPWeb、SPSite 或 SPSiteAdministration 物件時,若未使用指派集合或 Global 參數,將會自動處置這些物件。
使用 Global 參數時,所有物件會包含在全域儲存區內。 若未立即使用物件,或未使用 Stop-SPAssignment 命令處置物件,將會發生記憶體不足的狀況。
類型: | SPAssignmentCollection |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
適用於: | SharePoint Server Subscription Edition |
-Group
指定新使用者所屬的使用者群組。
類型: | SPGroupPipeBind |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
適用於: | SharePoint Server Subscription Edition |
-Identity
指定要傳回之使用者的識別碼或登入名稱。
此類型必須是有效的標識碼或登入名稱,例如傳統 Windows 驗證的 『CONTOSO\jdoe』 格式或 'i:0#.w|適用於 Windows 宣告的 CONTOSO\jdoe' 。
類型: | SPUserPipeBind |
別名: | UserAlias |
Position: | 1 |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
適用於: | SharePoint Server Subscription Edition |
-Limit
指定要傳回的使用者數上限。 預設值為 500。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
適用於: | SharePoint Server Subscription Edition |
-Web
指定要做為範圍的網站。
此類型必須是格式為 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID;SharePoint Foundation 網站的有效名稱 (例如 MySPSite1) ;或有效SPWeb對象的實例。
類型: | SPWebPipeBind |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
適用於: | SharePoint Server Subscription Edition |