Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Problems with login script

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problems with login script
  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 >>
 Problems with login script - 2/22/2005 8:33:07 PM   
  AzzerShaw

 

Posts: 25
Score: 0
Joined: 10/22/2004
From:
Status: offline
Hi,

I am having troubles with running this script

Const Printer_Mapping = "cn=U-MAP-P-Server-Share"
Const Map_X_Drive = "cn=U-MAP-D-Server-Share-X"
Const Printer_Mapping_Default = "cn=U-MAP-P-Server-Share"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:", "\\osys13\Ondemand\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, Printer_Mapping) Then

wshNetwork.AddWindowsPrinterConnection "\\L-CBSPRN01\L-CBSP001"

ElseIf InStr(strGroups, Printer_Mapping_Default) Then

wshNetwork.AddWindowsPrinterConnection "\\L-CBSPRN01\L-CBSP002"
wshNetWork.SetDefaultPrinter "\\L-CBSPRN01\L-CBSP002"

ElseIf InStr(strGroups, Map_X_Drive) Then

wshNetwork.MapNetworkDrive "g:", "\\osys10\jetforms\"

End If


An error message comes up saying

Line: 13
Char: 1
Error:Type mismatch: 'join'
Code: 800A000D
Sourc: M$ VBscript Runtime error

Unfortunely this is a sample script so i have no idea what is wrong with it Can someone please tell me what is wrong with it?

Thanks

Aaron
 
 
Post #: 1
 
 Re: Problems with login script - 2/22/2005 11:17:07 PM   
  simmo

 

Posts: 3
Score: 0
Joined: 2/21/2005
From:
Status: offline
Looks like currentuser.memberof in strGroups = LCase(Join(CurrentUser.MemberOf)) is returning the value of a different type than expected.

try

wscript.echo TypeName(CurrentUser.MemberOf)

to display what type of result is being returned.If you find you need to convert a single value result to string try cstr(....) :)

script56.chm should give you loads of info on which subtypes exist within VBScript.

Hope that helps

(in reply to AzzerShaw)
 
 
Post #: 2
 
 Re: Problems with login script - 2/22/2005 11:39:08 PM   
  AzzerShaw

 

Posts: 25
Score: 0
Joined: 10/22/2004
From:
Status: offline
I entered that in and it came back saying Variant() [V]

Im new to this and have not got a clue whats wrong with it

(in reply to AzzerShaw)
 
 
Post #: 3
 
 Re: Problems with login script - 2/23/2005 12:57:02 AM   
  moobycow

 

Posts: 1
Score: 0
Joined: 2/23/2005
From:
Status: offline
Why are you using a Join? That's for putting together strings held in an array. You're not returning an array so you don't want to use join.

Try this:

strGroups = LCase((CurrentUser.MemberOf)

(in reply to AzzerShaw)
 
 
Post #: 4
 
 Re: Problems with login script - 2/23/2005 1:30:23 AM   
  Bushmen

 

Posts: 122
Score: 0
Joined: 2/4/2005
From:
Status: offline
You can always try this:

sGroupname = "Users"
' Add the user to the group
Set oGroup = GetObject("WinNT://" & sComputerName & "/" & sGroupname)

' Use error handling in case he is a member already
On Error Resume Next
oGroup.Add(oUser.ADsPath)
On Error Goto 0

Regards,
Bushmen

(in reply to AzzerShaw)
 
 
Post #: 5
 
 Re: Problems with login script - 2/23/2005 3:03:19 AM   
  AzzerShaw

 

Posts: 25
Score: 0
Joined: 10/22/2004
From:
Status: offline
Thanks for the replies...

Just found out that its because VB is caps sensitive....

It works now....

....so im going for a lie down!!

(in reply to AzzerShaw)
 
 
Post #: 6
 
 Re: Problems with login script - 2/23/2005 10:44:10 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
moobycow: you have to use join because memberof returns an array.

Why do people still using instr function to determine whether a user belongs to a specific group ? :\

However, even if it does do the work, it is very likely to return incorrect information. Be warned :)

(in reply to AzzerShaw)
 
 
Post #: 7
 
 Re: Problems with login script - 2/23/2005 2:50:01 PM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
http://www.visualbasicscript.com/topic.asp?TOPIC_ID=2069

(in reply to AzzerShaw)
 
 
Post #: 8
 
 
 
  

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 >> Problems with login script 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