#73641 - 2003-02-25 05:49 PM
Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
I have written a script that was suppose to map drive to different groups depending on which group the user belong to. The operating systems that are on the workstations are XP pro and 2000 pro. However though when the script is ran only the first set of code is ran to office Staff. If the users are not in the Office staff group then their drive is not mapping. Can any one help me? Either you can post it to this bulletin board or email at anwar@josmithinsurance.com
SetConsole ("HIDE")
If INGROUP ("Office Staff") USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE O: /delete USE O: "\\josmith1\Jo Smith & Associates\OfficeStaff" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees"
If INGROUP ("Call Center") USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE T: /delete USE T: "\\josmith1\Jo Smith & Associates\CallCenter" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees"
If INGROUP ("CCAdmin") USE J: /delete USE J: "\\josmith1\Jo Smith & Associates\Jo Doc" USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE T: /delete USE T: "\\josmith1\Jo Smith & Associates\CallCenter" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE M: /delete USE M: "\\josmith1\Jo Smith & Associates\Accounting" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees"
If INGROUP ("Office Admin") USE J: /delete USE J: "\\josmith1\Jo Smith & Associates\Jo Doc" USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE O: /delete USE O: "\\josmith1\Jo Smith & Associates\OfficeStaff" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE M: /delete USE M: "\\josmith1\Jo Smith & Associates\Accounting" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees"
If INGROUP ("President") USE J: /delete USE J: "\\josmith1\Jo Smith & Associates\Jo Doc" USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE M: /delete USE M: "\\josmith1\Jo Smith & Associates\Accounting" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees" EndIf
EXIT
|
|
Top
|
|
|
|
#73643 - 2003-02-25 06:19 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
I have add the EndIf to my script and it still will not map the drives what am I doing wrong beside being fustrated
|
|
Top
|
|
|
|
#73645 - 2003-02-25 07:01 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
I have used the "debug On" command and recieved this msg.: "'\\JoSmith1\Netlogon' CMD.exe was started with the above path as the current directory. UNC path are not supported. Defaulting to Windows directory."
I deleted the Kixtart Key in using the regedit command to clear the token Cache and nothing has worked yet except for the first bit of coding mapping drives for the Office Staff group. I really need the help of the force.
|
|
Top
|
|
|
|
#73646 - 2003-02-25 07:05 PM
Re: Logon script for multi groups
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Please repost the code as you now have it written. Please place the code within the CODE tags. If you do not know how to use the code tags read the BBS help or ask. [ 25. February 2003, 19:06: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#73648 - 2003-02-25 07:39 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
code:
SetConsole ("HIDE")
If INGROUP ("Office Staff") USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE O: /delete USE O: "\\josmith1\Jo Smith & Associates\OfficeStaff" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees" EndIF
If INGROUP ("Call Center") USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE T: /delete USE T: "\\josmith1\Jo Smith & Associates\CallCenter" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees" EndIf
If INGROUP ("CCAdmin") USE J: /delete USE J: "\\josmith1\Jo Smith & Associates\Jo Doc" USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE T: /delete USE T: "\\josmith1\Jo Smith & Associates\CallCenter" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE M: /delete USE M: "\\josmith1\Jo Smith & Associates\Accounting" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees" EndIF
If INGROUP ("Office Admin") USE J: /delete USE J: "\\josmith1\Jo Smith & Associates\Jo Doc" USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE O: /delete USE O: "\\josmith1\Jo Smith & Associates\OfficeStaff" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE M: /delete USE M: "\\josmith1\Jo Smith & Associates\Accounting" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees" EndIf
If INGROUP ("President") USE J: /delete USE J: "\\josmith1\Jo Smith & Associates\Jo Doc" USE P: /delete USE P: "\\josmith1\Jo Smith & Associates\Public" USE S: /delete USE S: "\\josmith1\Jo Smith & Associates\ScanDocs" USE M: /delete USE M: "\\josmith1\Jo Smith & Associates\Accounting" USE N: /delete USE N: "\\josmith1\Jo Smith & Associates\Temp Employees" EndIf
EXIT
The above code is what I am trying to use. Only the first set of code is being ran which is the Office staff group. The user are members of the groups that need to have the mapped drives and still nothing
|
|
Top
|
|
|
|
#73650 - 2003-02-25 08:10 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
I receive the following msg.:
'\\Josmith1\netlogon' CMD.EXE was started with the above path as the current directory. UNC path are not supported. Defaulting to Windows diretory.
C:\Windows>debug on _file not found
Then that all I get. The batch code I am debugging is this:
code:
debug on @echo off CLS IF EXIST %WINDIR%\SYSTEM32\KIX32.EXE GOTO RunScripts IF EXIST C:\WINDOWS\SYSTEM32\KIX32.EXE GOTO WINDOWS IF "%OS%" == "Windows_XP" GOTO xplogon xcopy \\josmith1\KIXTART\KIX32.EXE %WINDIR%\SYSTEM32\ /D/H/I/R/V > NUL
GOTO xplogon :xplogon xcopy \\josmith1\KIXTART\KIX32.EXE C:\WINDOWS\SYSTEM32\ /D/H/I/R/V > NUL
GOTO WINDOWS :WINDOWS echo Loading Logon Scripts, Please Wait.... C:\WINDOWS\SYSTEM32\KIX32.EXE \\josmith1\KIXTART\joscript.kix
GOTO RunScripts :RunScripts echo Loading Logon Scripts, Please Wait.... %WINDIR%\SYSTEM32\KIX32.EXE \\josmith1\KIXTART\joscript.kix
echo on
I am trying to map drives to XP and 2000 workstations
|
|
Top
|
|
|
|
#73651 - 2003-02-25 08:15 PM
Re: Logon script for multi groups
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Save and then execute this script in a DOS window. Post the resulting log file (%temp%\logon.log)
code:
SetConsole ("HIDE")
; Drives N:, P:, S: were listed in each group so I placed it in the script only once MapDrive("N:", "josmith1", "Jo Smith & Associates\Temp Employees") MapDrive("P:", "josmith1", "Jo Smith & Associates\Public") MapDrive("S:", "josmith1", "Jo Smith & Associates\ScanDocs")
If INGROUP ("Office Staff") WriteLog("member of 'Office Staff'") MapDrive("O:", "josmith1", "Jo Smith & Associates\OfficeStaff") Else WriteLog("Not a member of 'Office Staff'") EndIF
If INGROUP ("Call Center") WriteLog("member of 'Call Center'") MapDrive("T:", "josmith1", "Jo Smith & Associates\CallCenter") Else WriteLog("Not a member of 'Call Center'") EndIf
If INGROUP ("CCAdmin") WriteLog("member of 'CCAdmin'") MapDrive("J:", "josmith1", "Jo Smith & Associates\Jo Doc") MapDrive("T:", "josmith1", "Jo Smith & Associates\CallCenter") MapDrive("M:", "josmith1", "Jo Smith & Associates\Accounting") Else WriteLog("Not a member of 'CCAdmin'") EndIF
If INGROUP ("Office Admin") WriteLog("member of 'Office Admin'") MapDrive("J:", "josmith1", "Jo Smith & Associates\Jo Doc") MapDrive("O:", "josmith1", "Jo Smith & Associates\OfficeStaff") MapDrive("M:", "josmith1", "Jo Smith & Associates\Accounting") Else WriteLog("Not a member of 'Office Admin'") EndIf
If INGROUP ("President") WriteLog("member of 'President'") MapDrive("J:", "josmith1", "Jo Smith & Associates\Jo Doc") MapDrive("M:", "josmith1", "Jo Smith & Associates\Accounting") Else WriteLog("Not a member of 'President'") EndIf
;-------------------------------------------------------------------------------------------
Function MapDrive($Drive, $Server, $Share) Dim $Drive, $Server, $Share Color c+/n If $Drive<>"" and $Server<>"" and $Share<>"" $LogText="Connecting $Drive to \\$Server\$Share" ? $LogText USE $Drive /Delete /Persistent USE $Drive "\\$Server\$Share" If @error=0 color g+/n $x=" - Success" "$x" Else color r+/n $x=" - Failed: Error @error" "$x" $ErrorState=1 Endif WriteLog ($LogText + $x) Color w+/n Else WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'") Endif Endfunction
Function WriteLog($text) dim $RC, $text, $LogFile, $Filehandle $Filehandle = 1 $LogFile = "%temp%\logon.log" $RC=Writeline ($Filehandle, "@Date @Time - $Text" + Chr(13) + Chr(10)) if $RC<0 $RC=Close ($Filehandle) $RC=Open ($Filehandle, $LogFile, 5) Select Case $RC=-1 $RC=MessageBox ("Invalid file name ($LogFile) specified for log file.","Logon Script Error",48) Case $RC=0 WriteLog ($Text) Case $RC=>0 $RC=MessageBox ("Error($RC) while attempting to open log file ($LogFile).","Logon Script Error",48) Endselect Endif EndFunction
[ 01. March 2003, 14:28: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#73653 - 2003-02-25 08:54 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
code:
SetConsole ("HIDE") ; Drives N:, P:, S: were listed in each group so I placed it in the script only once MapDrive("N:", "josmith1", "Jo Smith & Associates\Temp Employees") MapDrive("P:", "josmith1", "Jo Smith & Associates\Public") MapDrive("S:", "josmith1", "Jo Smith & Associates\ScanDocs") If INGROUP ("Office Staff") WriteLog("member of 'Office Staff'") MapDrive("O:", "josmith1", "Jo Smith & Associates\OfficeStaff") Else WriteLog("Not a member of 'Office Staff'") EndIF If INGROUP ("Call Center") WriteLog("member of 'Call Center'") MapDrive("T:", "josmith1", "Jo Smith & Associates\CallCenter") Else WriteLog("Not a member of 'Call Center'") EndIf If INGROUP ("CCAdmin") WriteLog("member of 'CCAdmin'") MapDrive("J:", "josmith1", "Jo Smith & Associates\Jo Documents") MapDrive("T:", "josmith1", "Jo Smith & Associates\CallCenter") MapDrive("M:", "josmith1", "Jo Smith & Associates\Accounting") Else WriteLog("Not a member of 'CCAdmin'") EndIF If INGROUP ("Office Admin") WriteLog("member of 'Office Admin'") MapDrive("J:", "josmith1", "Jo Smith & Associates\Jo Docucments") MapDrive("O:", "josmith1", "Jo Smith & Associates\OfficeStaff") MapDrive("M:", "josmith1", "Jo Smith & Associates\Accounting") Else WriteLog("Not a member of 'Office Admin'") EndIf If INGROUP ("President") WriteLog("member of 'President'") MapDrive("J:", "josmith1", "Jo Smith & Associates\Jo Documents") MapDrive("M:", "josmith1", "Jo Smith & Associates\Accounting") Else WriteLog("Not a member of 'President'") EndIf ;------------------------------------------------------------------------------------------- Function MapDrive($Drive, $Server, $Share) Dim $Drive, $Server, $Share Color c+/n If $Drive<>"" and $Server<>"" and $Share<>"" $LogText="Connecting $Drive to \\$Server\$Share" ? $LogText USE $Drive /Delete /Persistent USE $Drive "\\$Server\$Share" If @error=0 color g+/n $x=" - Success" "$x" Else color r+/n $x=" - Failed: Error @error" "$x" $ErrorState=1 Endif WriteLog ($LogText + $x) Color w+/n Else WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'") Endif EndfunctionFunction WriteLog($text) dim $RC, $text, $LogFile, $Filehandle $Filehandle = 1 $LogFile = "%temp%\logon.log" $RC=Writeline ($Filehandle, "@Date @Time - $Text" + Chr(13) + Chr(10)) if $RC<0 $RC=Close ($Filehandle) $RC=Open ($Filehandle, $LogFile, 5) Select Case $RC=-1 $RC=MessageBox ("Invalid file name ($LogFile) specified for log file.","Logon Script Error",48) Case $RC=0 WriteLog ($Text) Case $RC=>0 $RC=MessageBox ("Error($RC) while attempting to open log file ($LogFile).","Logon Script Error",48) Endselect Endif EndFunction
I did what you instructed, but when I ran it in DOS I received errors. Maybe I didn't do it right. I copied it and pasted it in DOS
|
|
Top
|
|
|
|
#73655 - 2003-02-25 09:00 PM
Re: Logon script for multi groups
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The text I posted is a KiXtart script is it not? You will have to save the text as a file - maybe named test.kix?
Then open a DOS window, change to the directory where you saved 'test.kix'.
execute "Kix32 test.kix"
Maybe you should review some of the KiXtart FAQs and HowTo's
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=10;t=000025
|
|
Top
|
|
|
|
#73656 - 2003-02-25 09:02 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
I do have administrative privilleges and the KIX32 is coping to the SYSTEM32 file. The script works if I only had one group to map but I don't and that is were the problem is. Everyone in the office staff group are getting the mapped drives but all the other groups are not.
|
|
Top
|
|
|
|
#73658 - 2003-02-25 09:42 PM
Re: Logon script for multi groups
|
anwar
Fresh Scripter
Registered: 2003-02-25
Posts: 17
Loc: texas
|
I have ran the DEBUG ON command on my kixtart script and the result is 0 . So does that mean there were no errors detected in my script?
|
|
Top
|
|
|
|
#73659 - 2003-02-25 09:45 PM
Re: Logon script for multi groups
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you execute the test script I posted. You will have a log of the scripts execution that will shed light on what might be or not be happening.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 973 anonymous users online.
|
|
|