ADSI to get local users

Welcome Forums General PowerShell Q&A ADSI to get local users

This topic contains 2 replies, has 2 voices, and was last updated by

VT
 
Participant
1 year, 5 months ago.

  • Author
    Posts
  • #73189
    VT

    Participant
    Points: 3
    Rank: Member

    when I run the above mentioned script in server 2008 (powershell v1.0), I am not getting output with the local user name...pls let me know if you can assist me in that...

    But its working fine in 2008R2 and also in 2012.

    $adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
    $adsi.Children | where {$_.SchemaClassName -eq 'user'} | Foreach-Object
    {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}
    $_ | Select-Object @{n='UserName';e={$_.Name}},@{n='Groups';e={[string]::Join(';',$groups)}}
  • #73286

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    v1 didn't implement an [ADSI] accelerator, I don't think.

    • #73295
      VT

      Participant
      Points: 3
      Rank: Member

      Thanks for clarifying that Don. Guess those servers needed to be updated to v2.0 or use wmi to get that result.

The topic ‘ADSI to get local users’ is closed to new replies.