function Global:get-module_exports {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
$ModName
)
$commands=(get-module $ModName).ExportedCommands
[Array[]]$list=(($commands).Values) | %{$_.Name} | Sort
$list
}
PS C:\> get-module -list
ModuleType Name ExportedCommands
---------- ---- ----------------
...
Manifest PSUserTools {}
....
PS C:\> import-module PSUserTools
PS C:\> get-module_exports PSUserTools
Get-CurrentUser
Get-Everyone
Start-ProcessAsAdministrator
Test-IsAdministrator
'Get-CurrentUser' queries WMI to find domain and local users. Here is a simplified function derived from that script that prints out local users and their SIDs:
function net_user
{
function netusers {$query = "Win32_UserAccount";$query+= " WHERE LocalAccount='True'";Get-WmiObject $query }
netusers | % {($_.name)+" "+($_.SID)}
}
PS C:\ net_user [SIDs deleted for privacy]
Administrator S-1-*
Guest S-1-*
rferrisx S-1-*
No comments:
Post a Comment