Where is $($env:UserProfile) is located for LCM

This topic contains 5 replies, has 2 voices, and was last updated by  Don Jones 2 months, 3 weeks ago.

  • Author
    Posts
  • #94740

    GS
    Participant

    With default configuration of LCM it seems to have inconsistent execution account. For [Script] resource it resolves to C:\Windows\system32\config\systemprofile while [File] resource is resolving to c:\users\client
    Is File resource actually being called as "client" user or how do find out where location of UserProfile for LCM is? I need to know this location since I need to create ".docker" subfolder there and put some config files there.

  • #94743

    Don Jones
    Keymaster

    It's going to depend, given that the LCM runs as System. The File resource in particular, being a binary module, is a little odd in a lot of ways. The LCM doesn't have a user profile and it doesn't run in a user's context. Individual resources, if provided with an alternate credential, would run in that user's context and normally with that user's profile.

  • #94746

    GS
    Participant

    My file resource writes to Destinationpath = "$($env:UserProfile)\.docker\key.pem" which resolves to c:\users\client for some reason. LCM is in default config and [File] is not using any alternative RunAs setting.

            File ClientKey{
                Destinationpath = "$($env:UserProfile)\.docker\key.pem"
                Contents        = $clientKey
                Force           = $true
            }
  • #94749

    Don Jones
    Keymaster

    Yyyyyyeah, but $env:userprofile, used in that context, would normally resolve when you run the script and create a MOF. What's in the MOF?

    • #94752

      GS
      Participant

      Oh, I see. I can not see MOF really since AzureAutomation compiles it and then client pulls it from Azure pull server. So this resolution actually baked into MOF as opposed to be resolved when executed on client?

  • #94755

    Don Jones
    Keymaster

    Yeah, basically just like any script. MOFs are static – they can't contain variables, except in a [Script] resource, obviously.

You must be logged in to reply to this topic.