Saltstack commands redirects to systemprofile



  • 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.



  • @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%.


  • Service Provider

    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.



  • @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.



  • @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


  • Service Provider

    @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?



  • @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


  • Service Provider

    @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.



  • @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


  • Service Provider

    @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.


Log in to reply
 

Looks like your connection to MangoLassi was lost, please wait while we try to reconnect.