Command to get the users list for whom rsop is present.

Ian Xue 81 Reputation points
2020-08-07T10:05:07.207+00:00

As we know to get the RSOP from users, the users need to satisfy two criteria, 1) the user should have logged into the computer atleast for one time, 2) the user should have permission to read the group policy results. I am looking for a command/script, to get the users list for whom the rsop is present.

source link
https://social.technet.microsoft.com/Forums/en-US/484989e2-717f-402b-acf8-125e4cae69c3/command-to-get-the-users-list-for-whom-rsop-is-present?forum=winserverGP

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,455 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,191 Reputation points Microsoft Vendor
    2020-08-07T10:07:22.96+00:00

    Hi,

    Thanks for your question.

    You can run GPResult or the powershell cmdlet Get-GPResultantSetOfPolicy to generate the RSoP information for users, but unfortunately neither of them could directly give a list of users which has the RSoP data. GPResult could throw an error message when a user doesn't have RSoP data.

    The code could be like this. It could take some time to run as the GPResult will try to generate RSoP for all the users.

    $users=Get-LocalUser 
    foreach($user in $users){
        if((GPResult /USER $user.name /R) -notlike "*does not have RSoP data.*"){
             $user.name | Out-File C:\userlist.txt -Append
        }  
    }
    
    0 comments No comments