Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for rhomedir.cmd

(view source code of rhomedir.cmd as plain text)

  1. /* Restore remote home directory shares */
  2.  
  3. /* Initialize RexxUtil */
  4. if RxFuncQuery( "SysFileTree" ) <> 0 then do
  5. 	call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  6. 	call SysLoadFuncs
  7. end
  8.  
  9. /* Do not display external commands */
  10. "@ECHO OFF"
  11.  
  12. /* Check and interpret command line parameter */
  13. parse upper arg "\\"server"\"drive"$\"homedir_path dummy
  14. if dummy          <> "" then call Syntax
  15. if server          = "" then call Syntax
  16. if drive           = "" then call Syntax
  17. if length( drive ) <> 1 then call Syntax
  18. if homedir_path    = "" then call Syntax
  19.  
  20. /* Read a list of all home directories */
  21. homedir_path = strip( homedir_path, "T", "\" )
  22. homedirs     = "\\"||server||"\"||drive||"$\"||homedir_path||"\*"
  23. call SysFileTree homedirs, "homedir.", "DO"
  24. if homedir.0 < 1 then do
  25. 	call Syntax "NoDirs"
  26. end
  27. else do i = 1 to homedir.0
  28. 	backslash  = lastpos( "\", homedir.i )
  29. 	share_name = substr( homedir.i, backslash + 1 )
  30. 	commando = "NET ADMIN \\"||server||" /C"
  31. 	commando = commando||" NET SHARE "||share_name||"="
  32. 	commando = commando||drive||":\"||homedir_path||"\"||share_name
  33. 	address CMD commando
  34. end
  35. EXIT 0
  36.  
  37.  
  38. Syntax:
  39. 	param = translate( arg( 1 ) )
  40. 	call SysCls
  41. 	say
  42. 	say "RHOMEDIR,  Version 1.01"
  43. 	say "(C) 1999, Rob van der Woude"
  44. 	say
  45. 	say "Remotely restore the shares of all home directories."
  46. 	say
  47. 	say "Use LHomeDir if you want to restore local shares."
  48. 	say
  49. 	if param = "NODIRS" then do
  50. 		say "No subdirectories found in"
  51. 		say "\\"||server||"\"||drive||"$\"||homedir_path
  52. 		say
  53. 	end
  54. 	say "Usage:  RHOMEDIR  <homedir_unc>"
  55. 	say
  56. 	say "where <homedir_unc> is the UNC name of the directory"
  57. 	say "containing the home directories"
  58. 	EXIT 1
  59. return
  60.  

page last modified: 2024-04-16; loaded in 0.0199 seconds