[THIN] Re: Home directory and Profile Script

  • From: "Andrew Wood" <andrew.wood@xxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Tue, 18 Oct 2005 23:08:09 +0100

But not on the TSProfilePath as its not a field you can reference directly
in AD is it? IIRC it's actually stored in userparameters which is a binary?

So, adodb to scoot through all the users, then initiate a user object and
use the ts extensions to interogate the ts properties..

Something like this - 

------------------------------
Option Explicit

Dim objCommand, objConnection, strBase, strFilter, strAttributes, objUser

Dim strQuery, objRecordset, strdistinguishedName, strTSPath, strCN


Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
'...change this bit for your domain
strBase = "<LDAP://dc=gilwood,dc=local>"

strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "sAMAccountName,cn,distinguishedName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
  strCN = objRecordSet.Fields("cn").Value
  strdistinguishedName = objRecordSet.Fields("distinguishedName").Value

  Set objUser = GetObject("LDAP://"; & strdistinguishedName)
  if Len(objUser.TerminalServicesProfilePath) > 0  Then _
  Wscript.Echo strCN & " " & objUser.TerminalServicesProfilePath

  objRecordSet.MoveNext
Loop

objConnection.Close 

------------------------------

More than happy for someone to point out a quicker way mind.

Personally - with W2k3 I've pretty much stopped using these settings and
simply set the ts profile and home directories as part of the loopback
policy.


-----Original Message-----
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Ormond_Merino@xxxxxxx
Sent: 18 October 2005 21:24
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Home directory and Profile Script

You could use ADODB.Command to query AD just like a SQL statement. A google
search should help.

Regards,
Ormond Merino

 
-----Original Message-----
From: msemon@xxxxxxx [mailto:msemon@xxxxxxx]
Sent: Tuesday, October 18, 2005 3:22 PM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Home directory and Profile Script

I am trying  to create a script to pull from Active Directory all users
which have TS Home Directories and Profiles. What I have so far works for a
single user account, for example jones. Is there a way to do this for all
users in AD.

 

Set objUser = GetObject _

    ("LDAP://cn=jonesBill,ou=Management,dc=NA,dc=dc1,dc=com";)
 

WScript.Echo "Terminal Services Profile Path : " & _

    objUser.TerminalServicesProfilePath 

WScript.Echo "Terminal Services Home Directory: " & _

    objUser.TerminalServicesHomeDirectory

WScript.Echo "Terminal Services Home Drive: " & _ 

    objUser.TerminalServicesHomeDrive

WScript.Echo "Allow Logon: " & objUser.AllowLogon

 

 

-Mike



--------------------------------------------------------------------
mail2web - Check your email from the web at http://mail2web.com/ .


********************************************************
This Weeks Sponsor: Cesura, Inc.
Know about Citrix end-user slowdowns before they know.
Know the probable cause, immediately.
Know it all now with this free white paper.
http://www.cesurasolutions.com/landing/WPBCForCitrix.htm?mc=WETBCC
********************************************************
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
ThinWiki community - Excellent SBC Search Capabilities!
http://www.thinwiki.com
***********************************************************
For Archives, to Unsubscribe, Subscribe or set Digest or Vacation mode use
the below link:
http://thin.net/citrixlist.cfm

-----------------------------------------
This message and any attachments are intended only for the use of the
addressee and may contain information that is privileged and confidential.
If the reader of the message is not the intended recipient or an authorized
representative of the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, notify the sender immediately by
return email and delete the message and any attachments from your system.


********************************************************
This Weeks Sponsor: Cesura, Inc.
Know about Citrix end-user slowdowns before they know.
Know the probable cause, immediately.
Know it all now with this free white paper.
http://www.cesurasolutions.com/landing/WPBCForCitrix.htm?mc=WETBCC
********************************************************
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
ThinWiki community - Excellent SBC Search Capabilities!
http://www.thinwiki.com
***********************************************************
For Archives, to Unsubscribe, Subscribe or set Digest or Vacation mode use
the below link:
http://thin.net/citrixlist.cfm

********************************************************
This Weeks Sponsor: Cesura, Inc.
Know about Citrix end-user slowdowns before they know.
Know the probable cause, immediately.
Know it all now with this free white paper.
http://www.cesurasolutions.com/landing/WPBCForCitrix.htm?mc=WETBCC
******************************************************** 
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
ThinWiki community - Excellent SBC Search Capabilities!
http://www.thinwiki.com
***********************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm

Other related posts: