Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for login_connect_network_drives_with_logging.kix

(view source code of login_connect_network_drives_with_logging.kix as plain text)

  1. ; It doesn't hurt to make sure the C:\temp folder exists
  2. MD "C:\temp"
  3.  
  4. ; Redirect messages to a log file, display
  5. ; a message dialog if redirection fails
  6. If RedirectOutput( "C:\temp\login.log", 1 ) <> 0
  7. 	$Msg = "Error logging the results.@CRLF"
  8. 	$Msg = $Msg + "Please notify the helpdesk.@CRLF"
  9. 	$Msg = $Msg + "For now, results will be displayed on screen."
  10. 	$RC  = MessageBox( $Msg, "Log File Error", 64, 300 )
  11. EndIf
  12.  
  13. $Error = 0
  14.  
  15. ; Map drive G: to the department share
  16. USE G: "\\CompanyServer\Dept"
  17. If @ERROR <> 0
  18. 	"Error @ERROR while trying to map drive G:@CRLF"
  19. 	$Error = $Error + 1
  20. EndIf
  21.  
  22. ; Map drive H: to the user's home share
  23. USE H: "\\CompanyServer\@HOMESHR"
  24. If @ERROR <> 0
  25. 	"Error @ERROR while trying to map drive H: to the homedir@CRLF"
  26. 	$Error = $Error + 1
  27. EndIf
  28.  
  29. ; List all mappings
  30. USE List
  31.  
  32. ; End redirection
  33. $RC = RedirectOutput( "" )
  34.  
  35. ; Warn the user if (an) error(s) occurred
  36. If $Error > 0
  37. 	$Msg = "$Error error(s) occurred during login.@CRLF"
  38. 	$Msg = $Msg + "The errors are logged to be "
  39. 	$Msg = $Msg + "reviewed by the helpdesk staff.@CRLF"
  40. 	$Msg = $Msg + "Please notify the helpdesk.@CRLF"
  41. 	$RC  = MessageBox( $Msg, "Login Error", 64 )
  42. EndIf

page last modified: 2022-10-20