Announcement

Collapse
No announcement yet.

Deleting Users Home Directories

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deleting Users Home Directories

    Hi, Long time user first time poster.

    I want to be able to automagically delete the users home directory and share. I have the share figured out, but the home dir escapes me. Here is a copy of my batch file and I will explain the problem:
    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    @echo on
    if %1 == ADD goto ADD
    if %1 == MODIFY goto MODIFY
    if %1 == DEL goto DEL
    goto END

    EL
    c:\rmtshare \\%5\%6 /DELETE
    rmdir /s /q %7
    goto END

    :ADD
    goto END

    :MODIFY
    goto END

    :END
    pause

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

    The Problem is i need to be able to go to
    %servername%\d$\pathtohomedirs\homedir

    I can use \\%5\this part I cant figure out\%3

    Help says use %7 for home dir path but when I add a pause to the CL I see that it shows \\servername\none.

    Any suggestions would be great.

    Version is 3.0K
    Thanks

  • #2
    Re: Deleting Users Home Directories

    Further to my last:

    I have about 10 servers that have home drives and different organizations have differnet paths to the home dir

    eg.

    \\server1\d$\groupa\userdata\homedir
    \\server1\d$\groupb\usersdata\homedir
    \\server2\d$\groupc\userdata\homedir


    hope this helps more

    Comment


    • #3
      Re: Deleting Users Home Directories

      The easiest way to troubleshoot this is to echo the variables so you can see what each one is:

      echo 1 = %1
      echo 2 = %2
      echo 3 = %3
      echo 4 = %4
      echo 5 = %5
      echo 6 = %6

      Put in a pause in your batch file and then delete a test user. When the window comes up it should pause so you can see what each of the variables actually translates to.

      Comment


      • #4
        Re: Deleting Users Home Directories

        Thx for the advice but it isn't much help

        I need to get the actuall path to the home dir ie
        \\serverX\d$\groupA\userdata\test.t$

        Is this possible.
        below is what the help file says about them, I need an explanation on %7

        %1 = Action. This value will be set to ADD for additions, DEL for deletions, MOD for a single user modification and MODS for multi-user modifications.
        %2 = Server
        %3 = Username
        %4 = Home Directory
        %5 = Home Directory Server
        %6 = Home Directory Share
        %7 = Home Directory Path
        %8 = Old (Former) Home Directory
        %9 = Date and Time


        Note %7 if this works then my script would work

        Any suggestions.

        Here is the output...I modified servernames

        C:\WINNT\system32>echo 1 = DEL
        1 = DEL
        C:\WINNT\system32>echo 2 = \\pdc
        2 = \\pdc
        C:\WINNT\system32>echo 3 = test.t
        3 = test.t
        C:\WINNT\system32>echo 4 = \\serverX\test.t$
        4 = \\serverX\test.t$
        C:\WINNT\system32>echo 5 = serverX
        5 = serverX
        C:\WINNT\system32>echo 6 = test.t$
        6 = test.t$
        C:\WINNT\system32>echo 7 = NONE
        7 = NONE
        C:\WINNT\system32>echo 8 = \\serverX\test.t$
        8 = \\serverX\test.t$

        Comment

        Working...
        X