如何使用 Powershell 列出用户和组?

如何使用 Powershell 列出用户和组?

我如何列出本地团体?

PS C:\Users\thufir>
PS C:\Users\thufir> Get-WMIObject win32_operatingsystem


SystemDirectory : C:\WINDOWS\system32
Organization    : Microsoft
BuildNumber     : 17134
RegisteredUser  : thufir
SerialNumber    : 00330-62820-00000-AAOEM
Version         : 10.0.17134



PS C:\Users\thufir>
PS C:\Users\thufir> get-LocalGroupMember
get-LocalGroupMember : The term 'get-LocalGroupMember' 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-LocalGroupMember
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (get-LocalGroupMember:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\thufir>
PS C:\Users\thufir> get-LocalGroup
get-LocalGroup : The term 'get-LocalGroup' 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-LocalGroup
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (get-LocalGroup:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\thufir>
PS C:\Users\thufir>

当然,运行compmgmt.msc会调出一个列出本地用户和组的 GUI。这是来自 Surface 3 的。

我尝试过以下解决方案:

https://stackoverflow.com/q/4548476/262852

- - - 编辑 - - - - - - -

看起来像是评论中讨论的配置问题:

PS C:\Users\thufir> PS C:\Users\thufir> PS C:\Users\thufir> PS C:\Users\thufir> Get-LocalGroup -Name "Administrators" Get-LocalGroup:术语“Get-LocalGroup”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。第 1 行,字符:1 + Get-LocalGroup -Name "Administrators" + ~~~~~~~~~~~~~~ + CategoryInfo:ObjectNotFound:(Get-LocalGroup:String) [],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException

PS C:\Users\thufir> PS C:\Users\thufir> PS C:\Users\thufir> PS C:\Users\thufir>

相关内容