Active Directory Terminal Services properties

The default Microsoft ActiveDirectory module doesn’t really support reading or writing Terminal Services properties. As you can see from the following example:

On the other hand, the Quest ActiveDirectory cmdlets do support this.
However, I prefer not to use third party add-ons if it isn’t absolutely necessary. So with some help from Google I found some great minds who showed me how to do it. And then I simply transformed it to cmdlets I can use in my day to day work.

The first function queries Terminal Services properties, again the function is declared global because of the way I load my functions into PowerShell.

And of course, the other function writes Terminal Services properties.
Since I had to use these functions recently to move TS profiles to another server I added a nifty little feature: When the function gets pipeline input then it will take the username for each input object and append it to any path you want to set. See the example in the script itself.
If the function doesn’t encounter any problems it will output nothing. I thought I could check the results with the previous function anyway. They both support pipeline input anyway.




Tagged , . Bookmark the permalink.

Comments are closed.