Perhaps this will help everyone get up to speed:
Mr T
New Member
Posts: 5
Score: 0
Joined: 3/1/2006
Status: online Hi,
I have the following script to change the Terminal Services Profile Paths for all members of a specific AD security Group. Problem is that it doesn't work. The script doesn't error and executes succesfully but the TS profile Path still will not change. I am new to VBScript and would appreciate if anyone could take a look at the script and let me know what could be wrong with it.
Set cn = Getobject("LDAP://cn=test group,ou=security Groups,ou=CCC,ou=DA,dc=uk,dc=ccc,dc=mydomain,dc=co,dc=uk")
For each obj in cn
if obj.TerminalServicesProfilePath = "\\ukcsql02\ts_profiles\" & obj.cn Then
obj.TerminalServicesProfilePath = "\\ukcsql02\ts_profiles\Optika\" & obj.cn
obj.setinfo
end if
next
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 9:32:34 AM
No New Messages
ebgreen
Super Member
Posts: 702
Score: 7
Joined: 7/12/2005
Status: online This is your entire script? You don't have On Error Resume Next somewhere in your script?
_____________________________
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
(in reply to Mr T)
Post #: 2
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 9:37:30 AM
No New Messages
Mr T
New Member
Posts: 5
Score: 0
Joined: 3/1/2006
Status: online Yep, this is my whole script. Unfortunately, I am brand new to VB script, looking to start scripting to make things easier.
I bought a couple of books that I have started reading.
Any advice on how to improve the script and get it working would be greatly appreciated.
(in reply to Mr T)
[Send Private Message] Report | Rate post | Post #: 3
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 9:42:18 AM
No New Messages
ebgreen
Super Member
Posts: 702
Score: 7
Joined: 7/12/2005
Status: online If you do this do you get anything listed?
Set cn = Getobject("LDAP://cn=test group,ou=security Groups,ou=CCC,ou=DA,dc=uk,dc=ccc,dc=mydomain,dc=co,dc=uk") For each obj in cn WScript.Echo obj.TerminalServicesProfilePath next
_____________________________
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
(in reply to Mr T)
Post #: 4
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 9:52:48 AM
No New Messages
Mr T
New Member
Posts: 5
Score: 0
Joined: 3/1/2006
Status: online I get nothing when I run the above script you provided, the script executes but nothing is displayed
I checked the full LDAP path from ADSIEDIT - (although the proper names are modified in this post).
Do I need to run this script on a DC?
(in reply to ebgreen)
[Send Private Message] Report | Rate post | Post #: 5
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 10:02:00 AM
No New Messages
ebgreen
Super Member
Posts: 702
Score: 7
Joined: 7/12/2005
Status: online Do you get a count displayed when you do this:
Set cn = Getobject("LDAP://cn=test group,ou=security Groups,ou=CCC,ou=DA,dc=uk,dc=ccc,dc=mydomain,dc=co,dc=uk") WScript.Echo cn.Count
_____________________________
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
(in reply to Mr T)
Post #: 6
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 10:10:52 AM
No New Messages
Mr T
New Member
Posts: 5
Score: 0
Joined: 3/1/2006
Status: online I get the following message on the cmd: -
C:\Documents and Settings\seige\Desktop\testTS.vbs(3, 1) Active Directory: Not implemented
(in reply to ebgreen)
[Send Private Message] Report | Rate post | Post #: 7
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 10:30:42 AM
No New Messages
ebgreen
Super Member
Posts: 702
Score: 7
Joined: 7/12/2005
Status: online Sounds like you are not getting a collection back at all then. I'm not a strong AD person. Perhaps someone that is will wander along.
_____________________________
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
(in reply to Mr T)
Post #: 8
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 10:31:53 AM
No New Messages
Mr T
New Member
Posts: 5
Score: 0
Joined: 3/1/2006
Status: online ... so I tried the following: -
intContainerCount = 0 Set objContainer = _ GetObject("LDAP://cn=test group,ou=security Groups,ou=CCC,ou=DA,dc=uk,dc=ccc,dc=mydomain,dc=co,dc=uk") For Each objLeaf In objContainer intContainerCount = intContainerCount + 1 Next WScript.Echo "Enumeration: " & intContainerCount
... and got the follwoing result on the cmd: - Enumeration = 0.
Now I know that their are members in this group so I then changed the LDAP to point to: - LDAP://ou=security Groups,ou=CCC,ou=DA,dc=uk,dc=ccc,dc=mydomain,dc=co,dc=uk
(Removed the cn=test group) and got the following result which I expect: - Enumeration = 37
So it would seem that the Count property isn't implemented by ADSI's LDAP provider (I don't know why) and also that I still cannot enumerate the leafobjects inside of the cn=test group object.
Any ideas?
(in reply to Mr T)
[Send Private Message] Report | Rate post | Post #: 9
RE: Help - Script to change TS Profile Path Not working! - 3/1/2006 10:34:13 AM
No New Messages
ebgreen
Super Member
Posts: 702
Score: 7
Joined: 7/12/2005
Status: online Please see the part about me not being a strong AD person (we must have been posting at the same time)
_____________________________
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
[red]
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]