nevermind i found the solution in another thread:
$user="root"
$pswd="password"
Get-VMHost|%{
$esx=Connect-VIServer$_.Name-User$user-Password$pswd
Get-VMHostAccount-Server$esx|
Select@{N="Host";E={$esx.Name}},@{N="Uid";E={$_.ExtensionData.Id}},Id,@{N="Name";E={$_.ExtensionData.FullName}}
Disconnect-VIServer-Server$esx-Confirm:$false
}