Announcement

Collapse
No announcement yet.

Moving multiple TS Profile directories

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

  • Moving multiple TS Profile directories

    I just purchased Hyena, and I'm wanting to manipulate multiple users TS profile directories. Basically, I want to blank out multiple users TS Profile path, and then move their TS Profile directory to another folder where it will sit until we feel like we can safely delete it.

    I have setup a batch file that will do the actualy copy for me, but when I put in %username%, it only copies my directory. Also, can I blank out the users' TS Profile diretory at the same time? I've created a "Tool" for this batch file. I know I can select multiple users, select properties, and put "~DEL" in their TS Profile Path, but is there a way for me to run the above batch file at the same time?

    I'll be happy to post the batch if you need me to, or if there is a way to do it inside of the application itself, I'd love to know how to do that.

    Thanks.

  • #2
    Re: Moving multiple TS Profile directories

    Hyena passes variables to the batch file as %1, %2, %3, etc. To access these from your batch file you'll put in %1 or whatever in the place you want it.

    To see what each variable translates to, put the following at the top of your batch file:

    echo 1=%1
    echo 2=%2
    echo 3=%3
    echo 4=%4
    echo 5=%5
    echo 6=%6
    echo 7=%7
    echo 8=%8
    pause

    Then change a user the way you have been and your batch file should run allowing you to see which variables you'll need to use.

    Comment


    • #3
      Re: Moving multiple TS Profile directories

      Thank you for the reply. When I select a user and run the batch file after I put echo 1=%1, it just echos "1=". Should it echo the username?

      Comment


      • #4
        Re: Moving multiple TS Profile directories

        How are you running the batch file?

        Comment


        • #5
          Re: Moving multiple TS Profile directories

          I created a "Tool" which is basically a short cut to a cmd file. I'm right clicking on the user, clicking on the batch file under tool, and then it runs.

          Comment


          • #6
            Re: Moving multiple TS Profile directories

            Sorry I thought you were using a post-user batch file.

            Since you are using a Custom Tool, the variables to use will relate to the column that contains the information you want. For example %C1%, %C2%, etc.

            Comment


            • #7
              Re: Moving multiple TS Profile directories

              Here's the line from my batch file:

              xcopy H:\profiles\%C1% c:\windows\temp\%C1% /e /i /g /h /k /o /y

              It works when I put %username% where %C1% is, but it will only copy my Profile directory. When I put %C!1%, it just puts a blank.

              Comment


              • #8
                Re: Moving multiple TS Profile directories

                Put that command in the actual tool in Hyena, rather than in a batch file. Let us know what that gives you.

                Comment


                • #9
                  Re: Moving multiple TS Profile directories

                  Ok...I went in to "Create Macro", pasted the whole batch file in to the macro and saved it as a .cmd file. This actually created a batch file that I could run to copy/move directories from the accounts I selected, but I was hoping there as a way I could select the users' accounts and then initiate this batch file and it pass the parameter of the username to the batch file without me having to create a file every time or exiting to cmd prompt to run it.

                  Is that possible? When I look at the "Tools", it really only allows me to run one command line instead of a whole batch file.

                  I know these are all newbie questions so I really appreciate you help.

                  -matt

                  Comment


                  • #10
                    Re: Moving multiple TS Profile directories

                    Running several different commands really would fit the Generate Macro option better, but you can use the Custom Tools by putting an & between the commands.

                    You'll have one long command in there with each separated by &.

                    Comment


                    • #11
                      Re: Moving multiple TS Profile directories

                      Ok...What if I want to put "IF" and "Echo" statements in to my batch file?

                      Here is what I want to do:


                      xcopy H:\profiles\%C1% c:\windows\temp\%C1% /e /i /g /h /k /o /y

                      If exist c:\windows\temp\%username%\desktop goto Good

                      :NoGood
                      Echo Not worky
                      Pause
                      Goto End

                      :Good
                      Echo Successful copy
                      rem rmdir h:\profiles\%username%
                      Pause

                      :END
                      Echo The End
                      Pause

                      I don't have to have the Echo statments, but I'd like to use it in the beginning to confirm things are working correctly. I have the "Confirm all File Copy and Move Operations" check marked, but that does not seem to matter.

                      Another thing, the command line under tools has a character limit, and I hit that with this batch file.

                      Thanks for you help.

                      Comment


                      • #12
                        Re: Moving multiple TS Profile directories

                        Oops...That is my test batch file. Here is the real deal:


                        xcopy H:\profiles\%C1% c:\windows\temp\%C1% /e /i /g /h /k /o /y

                        If exist c:\windows\temp\%c1%\desktop goto Good

                        :NoGood
                        Echo Not worky
                        Goto End

                        :Good
                        Echo Successful copy
                        rmdir h:\profiles\%C1%

                        :END
                        Echo The End
                        Pause

                        Comment


                        • #13
                          Re: Moving multiple TS Profile directories

                          Okay, here's a thought:

                          Create a Custom Tool with a syntax of:

                          c:\update.bat %C1%

                          Change update.bat to whatever your batch file is called, then edit your batch file and where you have %C1% change it to %1.

                          Then right-click on a user, choose Tools->tool_you_created and see what that does.

                          Comment


                          • #14
                            Re: Moving multiple TS Profile directories

                            That's works great! Thank you!

                            You are so the bomb!

                            Comment

                            Working...
                            X