none
Powershell script to find users and groups(admin groups) on non domain machines RRS feed

  • Question

  • Need a script to run on multiple servers that  looks for different user groups and users in those groups. Used to have one but apparently someone deleted it.. These servers are NON-domain bound, just in workstation group. any help would be greatly appreciated. Currently tweaking one but only worked in QA environment and not in production..
    Friday, March 1, 2019 7:33 PM

Answers

All replies

  • Post what you have now and any error that it is throwing or what error you are seeing that is causing it to fail in production. 

    Sometimes a second set of eyes is all you need. 

    Friday, March 1, 2019 8:21 PM
  • Need a script to run on multiple servers that  looks for different user groups and users in those groups...

    Please read the following post first, from right at the top of this forum:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Friday, March 1, 2019 9:01 PM
    Moderator
  • You will need the local admin module from the PowerShellGet repository.

    \_(ツ)_/

    Friday, March 1, 2019 10:24 PM
  • $cred = Get-Credential
    invoke-command { 
    $members = net localgroup administrators | 
    where {$_ -AND $_ -notmatch "command completed successfully"} | 
    select -skip 4 
    New-Object PSObject -Property @{ 
    Computername = $env:COMPUTERNAME 
    Group = "Administrators" 
    Members=$members 
    } 
    } -computer qa-te9srv01, qa-tstsrv01, qa-rdssh02 -HideComputerName | 
    Select * -ExcludeProperty RunspaceID | Export-CSV c:\output\local_admins.csv -NoTypeInformation

    Works in QA environment, just not quite formatted to what I'd like. On production, it returns a blank document. 

    Any input would be appreciated.

    Tuesday, March 5, 2019 10:04 PM
  • Thank you. seen powershell cmdlts for local admin that didnt work, probably why.
    Tuesday, March 5, 2019 10:07 PM
  • Thanks for your input.
    Tuesday, March 5, 2019 10:09 PM