Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - PowerShell access to AD user Terminal Services attributes

Reply
 
Old 07-12-2007   #1 (permalink)
John Yarborough


 
 

PowerShell access to AD user Terminal Services attributes

I've been looking at using PowerShell to help me manage my users in Active
Directory and so far I like everything that I am seeing. I have ran into an
issue though where I can not figure out how to access the users' Terminal
Services attributes.



Here is the command I am using to get the user information from Active
Directory:




Code Snippet
Get-WMIObject -class ds_user -namespace root\directory\ldap -computername .
| Select-Object DS_SAMAccountName






If I pipe it to Get-Member instead of Select-Object, I see a property called
ds_terminalServer but I don't know how to access it (if that is even an
option). I am new to PowerShell so I may just be missing something simple or
I may be on the completely incorrect path.



What I would like to see is when I do a Select-Object, to have a column for
the TS Profile Path, one for the TS Home Path, and then one for the TS Home
Drive Letter.



Thanks in advance for any advice.



John



My System SpecsSystem Spec
Old 07-12-2007   #2 (permalink)
/\/\o\/\/ [MVP]


 
 

RE: PowerShell access to AD user Terminal Services attributes

More information can be found at bottom of this post on old blog be aware
that the wrapper has changed a bit as this in a beta version, you need to add
PsObject before the invoke :

You can see this is stored in a DirectoryString named userParameters that is
not really readable , but again there are special Methods here for setting
this in the ADSI COM object you can Use with the invoke function , for a
Complete list look here on MSDN : IADsTSUserEx Property MethodsIADsTSUserEx
Property Methods

http://mow001.blogspot.com/2006/07/p...ry-part-3.html

"John Yarborough" wrote:

> I've been looking at using PowerShell to help me manage my users in Active
> Directory and so far I like everything that I am seeing. I have ran into an
> issue though where I can not figure out how to access the users' Terminal
> Services attributes.
>
>
>
> Here is the command I am using to get the user information from Active
> Directory:
>
>
>
>
> Code Snippet
> Get-WMIObject -class ds_user -namespace root\directory\ldap -computername .
> | Select-Object DS_SAMAccountName
>
>
>
>
>
>
> If I pipe it to Get-Member instead of Select-Object, I see a property called
> ds_terminalServer but I don't know how to access it (if that is even an
> option). I am new to PowerShell so I may just be missing something simple or
> I may be on the completely incorrect path.
>
>
>
> What I would like to see is when I do a Select-Object, to have a column for
> the TS Profile Path, one for the TS Home Path, and then one for the TS Home
> Drive Letter.
>
>
>
> Thanks in advance for any advice.
>
>
>
> John
>
>

My System SpecsSystem Spec
Old 07-13-2007   #3 (permalink)
Hal Rottenberg


 
 

Re: PowerShell access to AD user Terminal Services attributes

On Jul 12, 10:50 am, John Yarborough > Code Snippet
> Get-WMIObject -class ds_user -namespace root\directory\ldap -computername .
> | Select-Object DS_SAMAccountName
>
> If I pipe it to Get-Member instead of Select-Object, I see a property called
> ds_terminalServer but I don't know how to access it (if that is even an
> option).


Note this from the select-object help file:
"If you use Select-Object to select specified properties, it copies
the values of those properties from the input objects and creates new
objects that have the specified properties and copied values."

What this means is that instead of a WMI object with certain methods
and properties, you've created a new custom object that only has the
bits you've chosen. What you need to do is perform your operations on
the WMI object itself. Easiest way to do this is like so:

# $theusers = get-wmiobject -class ds_user -namespace root\directory
\ldap

Then access the properties using the "." operator:

# $theusers.DS_SAMAccountName

Also read the help files about_objects and about_properties.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Allow Log In Terminal Services .NET General
Terminal Services Client-Citrix access without disabling UAC Vista General
Terminal Services Vista General
Access web services through powershell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46