Hello
I try this function, but didnt have much success. The infos in the helpfile didnt helped me either.
what I want to do is simple.
Copy-File -Path "$dirSupportFiles\Config.xml" -Destination "$envAppData\Manufactor\Software\Config.xml"
This command I want to run in User Context, for that I try this function.
But the following code didnt work…
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-noexit -Command & {Copy-File -Path '$dirSupportFiles\Config.xml' -Destination '$envAppData\Avaya\Avaya one-X Communicator\Config.xml'}" -RunLevel HighestAvailable -Wait -PassThru
I struggle with the -Command part, the rest seems clear to me.
Hope anyone has an idea for me.
thanks
I usually run this as SYSTEM. It will write the changes to default user as well, unless you exclude.
<code>[string[]]$ProfilePaths = Get-UserProfiles | Select-Object -ExpandProperty 'ProfilePath'
ForEach ($ProfilePath in $ProfilePaths) {
Copy-File -Path "$dirSupportFiles\<filename>" -Destination "$ProfilePath\AppData\Roaming\<folder path>"
}
</code>
Hello,
Brian can you explain what the code does?
Does it execut the application installation with the System account, but retrieves the logged user and (for this example) copy the file into the %appdata% of the logged user?
Thank You,
The code as stated doesn’t state a: runas because this is ran with whatever credentials is used during the installation. All this code does it retrieve all user accounts on a machine and then runs what you want for each account. So this includes the logged on user because that account exists on the machine.