Get-LocalGroup
取得本機安全組。
語法
Default (預設值)
Get-LocalGroup
[[-Name] <String[]>]
[<CommonParameters>]
SecurityIdentifier
Get-LocalGroup
[[-SID] <SecurityIdentifier[]>]
[<CommonParameters>]
Description
Get-LocalGroup Cmdlet 會取得資訊安全帳戶管理員中的本機安全組。
此 Cmdlet 會取得您建立的預設內建群組和本機安全組。
備註
Microsoft.PowerShell.LocalAccounts 模組無法在 64 位系統上的 32 位 PowerShell 中使用。
範例
範例 1:取得系統管理員群組
Get-LocalGroup -Name "Administrators"
此命令會取得本機 Administrators 群組。 命令會在控制台中顯示群組的屬性。
參數
-Name
指定這個 Cmdlet 取得之安全組名稱的陣列。 您可以使用通配符。
參數屬性
| 類型: | String[] |
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
Default
| Position: | 0 |
| 必要: | False |
| 來自管線的值: | True |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
-SID
指定此 Cmdlet 取得之安全組之安全性識別碼的陣列。
參數屬性
| 類型: | |
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
SecurityIdentifier
| Position: | 0 |
| 必要: | False |
| 來自管線的值: | True |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
CommonParameters
此 Cmdlet 支援一般參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。
輸入
String
您可以使用管線將字串傳送到此 cmdlet。
SecurityIdentifier
您可以使用管線將 SID 傳送至此 Cmdlet。
輸出
System.Management.Automation.SecurityAccountsManager.LocalGroup
此 Cmdlet 會傳回本地組。
備註
Windows PowerShell 包含下列 Get-LocalGroup的別名:
glg
PrincipalSource 屬性是在 LocalUser、LocalGroup和 LocalPrincipal 物件上的屬性,用於描述物件的來源。 可能的來源如下所示:
- 本地
- Active Directory
- Microsoft Entra 群組
- Microsoft帳戶
只有 Windows 10、Windows Server 2016 和更新版本的 Windows 操作系統才支援 PrincipalSource。 對於較早的版本,屬性是空白的。