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
|