Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


case sensitive

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,35453
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> case sensitive
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 case sensitive - 6/15/2006 1:20:38 AM   
  BDIntern

 

Posts: 34
Score: 0
Joined: 5/19/2006
Status: offline
Yet another question. I was wondering if there is a way to ignore upper and lower case letters?

In this script I'm trying to compare the sAMAccountName to the cn (computer name). And if they match up out put a file with the results. But after going through the list of computers I found that all of the sAMAccount names are mixed upper and lower case, but all of the computer names are upper case.

Dim OutPutFile
Dim FileSystem
Dim Users
Dim Computers
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("Test.txt", True)
set objComputers = getobject("LDAP://ou=XPComputers,ou=Towson,dc=naptg,dc=com")
for each oComputer in objComputers
  Computers = oComputer.cn
 
  set objUsers = getobject("LDAP://ou=Users,ou=Towson,dc=naptg,dc=com")
  for each oUser in objUsers
  Users = oUser.sAMAccountName & "-xp"
      If Users = Computers Then
           OutPutFile.writeline Computers & " can be moved."
 wscript.echo Computers
      Else
           'OutPutFile.writeline "Error on:  " & Computers
      End If
  Next
Next

_____________________________

"640k ought to be enough for anybody"
-Bill Gates
 
 
Post #: 1
 
 RE: case sensitive - 6/15/2006 1:22:12 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
Dim OutPutFile
Dim FileSystem
Dim Users
Dim Computers
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("Test.txt", True)
set objComputers = getobject("LDAP://ou=XPComputers,ou=Towson,dc=naptg,dc=com")
for each oComputer in objComputers
  Computers = oComputer.cn
 
  set objUsers = getobject("LDAP://ou=Users,ou=Towson,dc=naptg,dc=com")
  for each oUser in objUsers
  Users = oUser.sAMAccountName & "-xp"
      If UCase(Users) = UCase(Computers) Then
           OutPutFile.writeline Computers & " can be moved."
 wscript.echo Computers
      Else
           'OutPutFile.writeline "Error on:  " & Computers
      End If
  Next
Next

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to BDIntern)
 
 
Post #: 2
 
 RE: case sensitive - 6/15/2006 1:27:38 AM   
  BDIntern

 

Posts: 34
Score: 0
Joined: 5/19/2006
Status: offline
Thanks again ....I hope you get paid well, your on top of things

Hey by the way I'm curious as to how the oUser works in the line "for each oUser in objUsers" is it the same as objItem?

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: case sensitive - 6/15/2006 1:57:30 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
If by getting paid well you mean by this site, then I am paid very well. I get answers to my questions when I need them and I get a sense of fulfillment from participating in an enjoyable community. That is payment enough.

As for your VBScript question. When you use a For Each construct, here is what you are really syaing:

For Each oUser In objUsers
   blah
   blah
   blah
Next

Take the collection objUsers and go through it one item at a time. For each item, assign that item to the variable oUser then do blah, blah, blah.

Does that clear it up for you?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to BDIntern)
 
 
Post #: 4
 
 RE: case sensitive - 6/15/2006 2:02:09 AM   
  BDIntern

 

Posts: 34
Score: 0
Joined: 5/19/2006
Status: offline
Thank You

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ebgreen)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> case sensitive Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts