Solved

Environment Tab (AD Users and Computers)

Posted on 2015-01-12
4
325 Views
Last Modified: 2015-01-12
Hello,

In the Environment Tab in AD Users and Computers, there is a check box to 'Start the following program at logon'.  I am looking for a script or query to show all users that are configured with this box checked.

Can anyone point me in the right direction?

Thanks,

TB
0
Comment
Question by:TropicalBound
4 Comments
 
LVL 13

Expert Comment

by:Alexios
ID: 40544830
Hello
Sorry but can you please be more specific in what exactly you need

Thank you
0
 
LVL 6

Assisted Solution

by:Kiran Ch
Kiran Ch earned 250 total points
ID: 40544912
Hi,

You would need to query the attribute value called "TerminalServicesInitialProgram".
This below gives you exactly what you are looking for.
https://social.technet.microsoft.com/Forums/windowsserver/en-US/a82f326f-c2a6-4f57-85b8-f9f5c2063b46/use-powershell-to-read-environment-tab-checkbox-from-aduc?forum=winserverpowershell
0
 
LVL 33

Accepted Solution

by:
it_saige earned 250 total points
ID: 40545122
You could run the following powershell script based on the above recommendation:
$users = Get-AdUser -Filter *
Foreach($usr in $users)
{
    $u=Get-ADUser $usr
    $user = [adsi]"LDAP://$($U.DistinguishedName)"
    try
    {
        $user.PSBase.Invokeget("TerminalServicesInitialProgram")
    }
    Catch
    {
        if($_.exception.message -like "*The directory property cannot be found*")
        {
            write-host "$usr hasn't been set this option"
        }
    }
}

Open in new window

-saige-
0
 
LVL 3

Author Closing Comment

by:TropicalBound
ID: 40545187
Exactly what I needed!

Thanks to you both!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question