Login | |
|
 |
Re: Script Not Detecting User In Group - 3/11/2005 1:48:37 AM
|
|
 |
|
| |
cjwallace
Posts: 491
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
|
quote: Originally posted by Bushmen cjwallace, i can not see much wrong with your script, although you really need to troubleshoot your script more as per Beaker's comments. A good way to troubleshoot your script is to use a good debugger. Then add watches to Variables and see what your script is really doing. If you don't have access to a good debugger, then something as simple as message boxes, can be of great help. Maybe change --------------------------------- For Each Prop In objUser.groups Select Case Prop.Name --------------------------------- to --------------------------------- For Each Prop In objUser.groups Msgbox Prop.Name Select Case Prop.Name --------------------------------- This way you can see if the script recognises the correct group/s. Then, if you are happy that that is working, add another messagebox to every sub, so that you can see if the sub is running.. I know this is very basic stuff, but you need to take small steps at a time in your script when troubleshooting, rather than looking at a couple of pages of code looking for a problem. Bushmen
Bushmen: , Thanks for your message. I have changed my code as per your message. When i run the script i get a box with all the groups the script thinks the user is in, when i run it on mine it tells me all the groups i am a member of but when i run it on my work mates computer it only displays Domain Users Is there anything else i could try? Is there any good free debuggers i could try? Thanks again for your help so far
|
|
| |
|
|
|
 |
Re: Script Not Detecting User In Group - 3/11/2005 9:49:13 PM
|
|
 |
|
| |
cjwallace
Posts: 491
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
|
Guys, Thanks for your reply: Token: it is a login script that once runs opens an IE Windows to display what groups the users are in and what drives its mapping etc , then it shuts the IE window down. Bushman: I have done a further bit of testing this morning, If i log into one of my work mate computer i only get mapped the drives that are for Domain users & not the rest of the drives that i am a member of , also if i log one of my work mates into my computer they get all the mapped drives according to there groups. Below is an up to date copy of the login script with all changes made to date. Thanks to everyone who is trying to help me with this On Error Resume Next Dim WshNetwork, asdPath, User Dim strMappedDrives, strStatus Dim IE Dim objFSO set shell = createobject("wscript.shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Const ADS_READONLY_SERVER = 5 ' Display IE status window Call CreateIE() strStatus = "Please call x6440 with any Login issues " & Date() ie.document.all.wstatus.InnerText = strMsg3 ' Get the User ID Set WSHNetwork = WScript.CreateObject("WScript.Network") strUser = "" While strUser = "" strUser = WSHNetwork.UserName Wend ie.document.all.Msg1.InnerText = strUser call main() strStatus = strStatus & vbCRLF & "Withers LLP London Network Logon Complete..." ie.document.all.wstatus.InnerText = strStatus ' Close IE status window If not ie.document.all.holdit.checked then ie.quit() End if ' End of logon script Public Sub Main() 'Main loop to detect group that user belongs to Set objUser = GetObject("WinNT://London/" & strUser & ",user") Set dso = GetObject("WinNT:") For Each Prop In objUser.groups rem Msgbox Prop.Name if Prop.Name = "Domain Users" then Call DomainUsers() end if if Prop.Name = "Photos" then Call Photos() end if if Prop.Name = "DigitalPhotos" then Call DigitalPhotos() end if if Prop.Name = "Helpdesk" then Call Helpdesk() end if if Prop.Name = "Systems" then Call Systems() end if 'etc Next 'Prop End Sub Sub DomainUsers() strStatus = strStatus & vbCRLF & "Member of London Domain Users..." ie.document.all.wstatus.InnerText = strStatus shell.run ("net time \\atlas /set /yes") MapDrive "S:", "\\poseidon\data" MapDrive "V:", "\\poseidon\apps" shell.run ("net use \\zeus\zenapps") shell.run ("net use \\atlas\crispdata") objFSO.CopyFile "\\zeus\zenapps\nav\grc.dat", "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\" shell.run ("cmd /c attrib -h c:\program files\Microsoft Office\office\startup\*.*"),0,true End Sub Sub Photos() strStatus = strStatus & vbCRLF & "Member of Photos Group on HEBE..." ie.document.all.wstatus.InnerText = strStatus MapDrive "P:", "\\hebe\photos" End Sub Sub DigitalPhotos() strStatus = strStatus & vbCRLF & "Member of JDM DigitalPhotos on HEBE..." ie.document.all.wstatus.InnerText = strStatus MapDrive "Q:", "\\hebe\digitalphotos" End Sub Sub Helpdesk() strStatus = strStatus & vbCRLF & "Member of ITSTUFF on HYPERION..." ie.document.all.wstatus.InnerText = strStatus MapDrive "I:", "\\Hyperion\itstuff" MapDrive "Y:", "\\poseidon\home$" MapDrive "Z:", "\\zeus\zenapps\withersdocs.ini" End Sub Sub Systems() strStatus = strStatus & vbCRLF & "Member of London Systems Team..." ie.document.all.wstatus.InnerText = strStatus MapDrive "I:", "\\Hyperion\itstuff" MapDrive "Y:", "\\poseidon\home$" MapDrive "Z:", "\\zeus\zenapps" End Sub Sub CreateIE() On Error Resume Next Set IE = CreateObject("InternetExplorer.Application") With IE .navigate "\\atlas\netlogon\uk\logon.htm" .resizable=0 .height=470 .width=350 .menubar=0 .toolbar=0 .statusBar=0 .visible=1 End With SecondsToDelay = "2" Wscript.Sleep(SecondsToDelay * 2000) End Sub Sub MapDrive(strDrive,strShare) On Error Resume Next WSHNetwork.MapNetworkDrive strDrive, strShare On Error Resume Next WSHNetwork.MapNetworkDrive strDrive, strShare If Err.Number Then WSHNetwork.RemoveNetworkDrive strDrive WSHNetwork.MapNetworkDrive strDrive, strShare End If strMappedDrives = strMappedDrives & strDrive & " " ie.document.all.Msg2.InnerText = strMappedDrives End Sub
|
|
| |
|
|
|
|
|