Solved

Environment Tab (AD Users and Computers)

Posted on 2015-01-12
4
303 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to resolve user quota error? 13 68
slow IIS responses after Microsoft December 2016 patches 3 41
DHCP lease duration / Migration 8 53
Windows Folder Permissions 9 46
Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
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…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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…

777 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