New To Scripting and Script does not work 
Author Message
 New To Scripting and Script does not work

I am a VBScript newbie and am having trouble getting going.  I am
trying to run a script against my Windows 2000 (win2k) domain.  Even
the sample scripts I try don't work!  I copied one below that I got
from Microsoft's Script Center.  I modified the username and domain to
what I thought would be correct but no luck.

I get the pop-up boxes, but they contain no information.  The account
contains information since I put it there to test.

Another question, what if the OU is two words (like "Domain
Accounts").  How would that look in the LDAP statement?

Any help would be appreciated.

**** Original Script from System Administration Scripting Guide Script
Repository Version 1.1, August 2002

On Error Resume Next
Set objUser = GetObject _
  ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
objUser.GetInfo

strTitle = objUser.Get("title")
strDepartment = objUser.Get("department")
strCompany = objUser.Get("company")
strManager = objUser.Get("manager")

strDirectReports = _
  objUser.GetEx("directReports")

WScript.echo "title: " & strTitle
WScript.echo "department: " & strDepartment
WScript.echo "company: " & strCompany
WScript.echo "manager: " & strManager

For Each strValue in strDirectReports
  WScript.echo "directReports: " & strValue
Next

**** Modified Script that does not work
**** Name is Arthur Dent, user login name is ADent, user is in a
nested OU (one below the other) of KY\Users, Domain is City.net (was
City_KY)
**** note the Domain was an upgrade from NT 4.0 to Windows 2000

On Error Resume Next
Set objUser = GetObject _
  ("LDAP://cn=adent,ou=users,ou=ky,dc=city,dc=net")
objUser.GetInfo

strTitle = objUser.Get("title")
strDepartment = objUser.Get("department")
strCompany = objUser.Get("company")
strManager = objUser.Get("manager")

strDirectReports = _
  objUser.GetEx("directReports")

WScript.echo "title: " & strTitle
WScript.echo "department: " & strDepartment
WScript.echo "company: " & strCompany
WScript.echo "manager: " & strManager

For Each strValue in strDirectReports
  WScript.echo "directReports: " & strValue
Next



Mon, 01 Aug 2005 11:45:19 GMT  
 New To Scripting and Script does not work
What OS are you using?

Just kidding!


Quote:
> I am a VBScript newbie and am having trouble getting going.  I am
> trying to run a script against my Windows 2000 (win2k) domain.  Even
> the sample scripts I try don't work!  I copied one below that I got
> from Microsoft's Script Center.  I modified the username and domain to
> what I thought would be correct but no luck.

> I get the pop-up boxes, but they contain no information.  The account
> contains information since I put it there to test.

> Another question, what if the OU is two words (like "Domain
> Accounts").  How would that look in the LDAP statement?

> Any help would be appreciated.

> **** Original Script from System Administration Scripting Guide Script
> Repository Version 1.1, August 2002

> On Error Resume Next
> Set objUser = GetObject _
>   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
> objUser.GetInfo

> strTitle = objUser.Get("title")
> strDepartment = objUser.Get("department")
> strCompany = objUser.Get("company")
> strManager = objUser.Get("manager")

> strDirectReports = _
>   objUser.GetEx("directReports")

> WScript.echo "title: " & strTitle
> WScript.echo "department: " & strDepartment
> WScript.echo "company: " & strCompany
> WScript.echo "manager: " & strManager

> For Each strValue in strDirectReports
>   WScript.echo "directReports: " & strValue
> Next

> **** Modified Script that does not work
> **** Name is Arthur Dent, user login name is ADent, user is in a
> nested OU (one below the other) of KY\Users, Domain is City.net (was
> City_KY)
> **** note the Domain was an upgrade from NT 4.0 to Windows 2000

> On Error Resume Next
> Set objUser = GetObject _
>   ("LDAP://cn=adent,ou=users,ou=ky,dc=city,dc=net")
> objUser.GetInfo

> strTitle = objUser.Get("title")
> strDepartment = objUser.Get("department")
> strCompany = objUser.Get("company")
> strManager = objUser.Get("manager")

> strDirectReports = _
>   objUser.GetEx("directReports")

> WScript.echo "title: " & strTitle
> WScript.echo "department: " & strDepartment
> WScript.echo "company: " & strCompany
> WScript.echo "manager: " & strManager

> For Each strValue in strDirectReports
>   WScript.echo "directReports: " & strValue
> Next



Mon, 01 Aug 2005 16:03:11 GMT  
 New To Scripting and Script does not work
Hi,

First, I would recommend removing the "On Error Resume
Next" statement, as that masks errors and makes
troubleshooting very difficult.

Next, if the logon name is "ADent", that's probably the NT
logon name, also called the pre-W2k logon name, or the
sAMAccountName. What you need for the LDAP provider is
the "cn" (Common Name) attribute. In this case, it might
be "Arthur Dent". This property is sometimes called
the "Full Name", which is confusing. It is the "Name"
displayed in AD Users & Computers.

Finally, all names in the LDAP binding string can have
spaces. For example:

"LDAP://cn=adent,ou=domain accounts,ou=ky,dc=city,dc=net"

or

"LDAP://cn=Arthur Dent,ou=users,ou=ky,dc=city,dc=net"

Richard

Quote:
>-----Original Message-----
>I am a VBScript newbie and am having trouble getting
going.  I am
>trying to run a script against my Windows 2000 (win2k)
domain.  Even
>the sample scripts I try don't work!  I copied one below
that I got
>from Microsoft's Script Center.  I modified the username
and domain to
>what I thought would be correct but no luck.

>I get the pop-up boxes, but they contain no information.  
The account
>contains information since I put it there to test.

>Another question, what if the OU is two words
(like "Domain
>Accounts").  How would that look in the LDAP statement?

>Any help would be appreciated.

>**** Original Script from System Administration Scripting
Guide Script
>Repository Version 1.1, August 2002

>On Error Resume Next
>Set objUser = GetObject _
>  ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
>objUser.GetInfo

>strTitle = objUser.Get("title")
>strDepartment = objUser.Get("department")
>strCompany = objUser.Get("company")
>strManager = objUser.Get("manager")

>strDirectReports = _
>  objUser.GetEx("directReports")

>WScript.echo "title: " & strTitle
>WScript.echo "department: " & strDepartment
>WScript.echo "company: " & strCompany
>WScript.echo "manager: " & strManager

>For Each strValue in strDirectReports
>  WScript.echo "directReports: " & strValue
>Next

>**** Modified Script that does not work
>**** Name is Arthur Dent, user login name is ADent, user
is in a
>nested OU (one below the other) of KY\Users, Domain is
City.net (was
>City_KY)
>**** note the Domain was an upgrade from NT 4.0 to
Windows 2000

>On Error Resume Next
>Set objUser = GetObject _
>  ("LDAP://cn=adent,ou=users,ou=ky,dc=city,dc=net")
>objUser.GetInfo

>strTitle = objUser.Get("title")
>strDepartment = objUser.Get("department")
>strCompany = objUser.Get("company")
>strManager = objUser.Get("manager")

>strDirectReports = _
>  objUser.GetEx("directReports")

>WScript.echo "title: " & strTitle
>WScript.echo "department: " & strDepartment
>WScript.echo "company: " & strCompany
>WScript.echo "manager: " & strManager

>For Each strValue in strDirectReports
>  WScript.echo "directReports: " & strValue
>Next
>.



Tue, 02 Aug 2005 02:42:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. New To Scripting and Script does not work

2. Valid script does not work with Scripting Object Model

3. Valid script does not work with Scripting Object Model

4. New to scripting - can this be done?

5. Why doe the BLUR not work in IE ???

6. VB script not working in IE 5

7. Scripts Not Working Under IE5.0

8. Script Debugger not working after VID 6.0

9. Controls not working under scripting host

10. VbCr not working in ASP Email Script

11. Suspend Script Not Working??

12. A simple script still does not work

 

 
Powered by phpBB® Forum Software