Solved

Environment Tab (AD Users and Computers)

Posted on 2015-01-12
4
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 34

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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
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…

752 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