Need powercli script to list user account in ESXi servers
My mistake, try something like this
$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
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use the Get-VMHostAccount cmdlet to list user accounts in ESXi servers.
You can try
foreach($esx in Get-VMHost){
Get-VMHostAccount -VMHost $esx |
Select @{N="Host";E={$esx.Name}},Uid,Id,Name,Description
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks for the script.
But i get the below error message
Please have a look , here is some script for you..
http://www.kasraeian.com/2012/04/using-vmware-powercli-002-user-accounts/
My mistake, try something like this
$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
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Connect-VIServer 1.1.1.1
$esxihosts = Get-VMHost
foreach ($esxihost in $esxihosts)
{
$esxcli = get-esxcli -VMHost $esxihost
$account = $esxcli.system.account.list()
$account | Select @{N="Host";E={$esxihost.Name}},UserId | Export-csv -append -Path C:\temp\acc.csv -NoTypeInformation
}