PowerShell 5.1(随着 Windows 10 和 Server 2016 发布)现在原生支持管理本地账户。在前一个技能中您学习了如何使用 Get-LocalUser
命令。
要探索本地账户管理的其它 cmdlet,以下是如何识别暴露 Get-LocalUser
命令的模块的方法,然后列出该模块的其它 cmdlet:
1 2 3 4 5 6 7 8
|
$module = Get-Command -Name Get-LocalUser | Select-Object -ExpandProperty Source
Get-Command -Module $module
|
最终,列出所有新的管理 cmdlet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Add-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Disable-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Enable-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Get-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Get-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Get-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet New-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet New-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Remove-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Remove-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Remove-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Rename-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Rename-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Set-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Set-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
|