Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Environment Tab (AD Users and Computers)

Posted on 2015-01-12
4
Medium Priority
?
440 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 1000 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 35

Accepted Solution

by:
it_saige earned 1000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

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.
For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

916 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