ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Saltstack commands redirects to systemprofile

    IT Discussion
    4
    10
    814
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Emad RE
      Emad R
      last edited by

      Hello,

      So I found myself getting to this issue alot lately, I wonder if some can help.

      So I want to backup files using salt, and when I run commands with variables like %USERPROFILE%\Desktop

      C:\Windows\System32\config\systemprofile\Desktop

      And backs up the files of that location, instead of the files of the current user.

      Now 1 way is to have standard non AD local user account on all the machines with same name:
      C:\Users\msffuser

      but is there anyway else ?

      and what is the quickest way to create new local user if needed and migrate all the existing account to the new msffuser without losing any data.

      Thanks.

      travisdh1T 1 Reply Last reply Reply Quote 0
      • travisdh1T
        travisdh1 @Emad R
        last edited by

        @msff-amman-Itofficer Seems like salt is uses some sort of system account. You'd have to add salt logging in as the user before running a script with user land variables like %USERPROFILE%.

        Emad RE 1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller
          last edited by

          If you think about it, that variable would run in the context of Salt itself. So makes no sense. You need to back up the user in question, not Salt's own files.

          Emad RE 1 Reply Last reply Reply Quote 0
          • Emad RE
            Emad R @travisdh1
            last edited by

            @travisdh1 said in Saltstack commands redirects to systemprofile:

            @msff-amman-Itofficer Seems like salt is uses some sort of system account. You'd have to add salt logging in as the user before running a script with user land variables like %USERPROFILE%.

            I know the cmd.runas stuff, but how can I make this work globally...

            Aha perhaps add salt user globally to my minions, and run the command as that user, but that will backup the new salt user profile, not the existing user profile.

            Better yet I make it to backup the %SYSTEMDRIVE%\Users folder all instead and be sure.

            scottalanmillerS 1 Reply Last reply Reply Quote 0
            • Emad RE
              Emad R @scottalanmiller
              last edited by

              @scottalanmiller said in Saltstack commands redirects to systemprofile:

              If you think about it, that variable would run in the context of Salt itself. So makes no sense. You need to back up the user in question, not Salt's own files.

              Yh just wondered if there is command that I can use to pinpoint that user, but the safest thing to do is to simply grab this :

              %SYSTEMDRIVE%\Users

              and that would do, even if it took extra files.

              The environment I inherited does not have standard Windows user naming

              Sometimes it helps to ask those questions, and then later reply to my self and find out a solution

              1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller @Emad R
                last edited by

                @msff-amman-Itofficer said in Saltstack commands redirects to systemprofile:

                @travisdh1 said in Saltstack commands redirects to systemprofile:

                @msff-amman-Itofficer Seems like salt is uses some sort of system account. You'd have to add salt logging in as the user before running a script with user land variables like %USERPROFILE%.

                I know the cmd.runas stuff, but how can I make this work globally...

                Aha perhaps add salt user globally to my minions, and run the command as that user, but that will backup the new salt user profile, not the existing user profile.

                Better yet I make it to backup the %SYSTEMDRIVE%\Users folder all instead and be sure.

                You are looking at this conceptually incorrectly. From your description, I'm not even sure WHO you want to back up. Only the currently logged in user? What if no one is logged in?

                Emad RE 1 Reply Last reply Reply Quote 0
                • Emad RE
                  Emad R @scottalanmiller
                  last edited by

                  @scottalanmiller

                  I want to backup the user account with the most data ? the thing is we have different user account names on each computer, and that is the why I am having issues, if only I can find way to run as logged in user

                  scottalanmillerS 1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller @Emad R
                    last edited by

                    @msff-amman-Itofficer said in Saltstack commands redirects to systemprofile:

                    I want to backup the user account with the most data ? the thing is we have different user account names on each computer, and that is the why I am having issues, if only I can find way to run as logged in user

                    Odd, but, okay. So with or without salt to do this your approach would not work. You need to do some detection as to what folders hold the most data, then back that up. That variable won't give you that information even with logged in users.

                    DashrenderD 1 Reply Last reply Reply Quote 1
                    • DashrenderD
                      Dashrender @scottalanmiller
                      last edited by

                      @scottalanmiller said in Saltstack commands redirects to systemprofile:

                      @msff-amman-Itofficer said in Saltstack commands redirects to systemprofile:

                      I want to backup the user account with the most data ? the thing is we have different user account names on each computer, and that is the why I am having issues, if only I can find way to run as logged in user

                      Odd, but, okay. So with or without salt to do this your approach would not work. You need to do some detection as to what folders hold the most data, then back that up. That variable won't give you that information even with logged in users.

                      Yeah - I think your idea of backing up %systemroot%\users is probably the way to go

                      scottalanmillerS 1 Reply Last reply Reply Quote 1
                      • scottalanmillerS
                        scottalanmiller @Dashrender
                        last edited by

                        @Dashrender said in Saltstack commands redirects to systemprofile:

                        @scottalanmiller said in Saltstack commands redirects to systemprofile:

                        @msff-amman-Itofficer said in Saltstack commands redirects to systemprofile:

                        I want to backup the user account with the most data ? the thing is we have different user account names on each computer, and that is the why I am having issues, if only I can find way to run as logged in user

                        Odd, but, okay. So with or without salt to do this your approach would not work. You need to do some detection as to what folders hold the most data, then back that up. That variable won't give you that information even with logged in users.

                        Yeah - I think your idea of backing up %systemroot%\users is probably the way to go

                        Yes, grabbing EVERYTHING seems like it would be the most logical.

                        1 Reply Last reply Reply Quote 1
                        • 1 / 1
                        • First post
                          Last post