Access denied folder C:\Windows\System32\config\systemprofile

Advertisement

atlasmichael
Joined:
Posts:
1

Access denied folder C:\Windows\System32\config\systemprofile

Hello everybody

I am setting up a PowerShell to retrieve files from an SFTP server.
When I run it from the server with my administrator account, it works perfectly from the GUI.
When I perform the same test without being connected to the GUI with a user profile, I get an error message:
access deneid folder C:\Windows\System32\config\systemprofile\Temp.
I tried to give the rights to the user and it still does not work.
We also used a portable version from a bat script with the user profile and no problem encountered.

Is it possible to change the location of the Temp directory?

Do you have any other solution?

One possibility in my opinion would be to give the user the Administrator rights which is not the best for our institution.

You will find attached the connection method used.

I thank you in advance for your help

Sincerely
Michael

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: Access denied folder C:\Windows\System32\config\systemprofile

Please provide us with step-by-step instructions for reproducing the problem.

Reply with quote

Michael.atlas37@...
Guest

Re: Access denied folder C:\Windows\System32\config\systemprofile

Hello Martin,
Thank you for your feedback.
I have finally found the solution.
To help you analyze the problem you will find the steps below.
The steps are as follows:
  1. Call to a TERMINAL, with parameters passage (from an internal application, use user SYSTEM). Ex:
    powershell.exe c:\...\winscp.ps1 users psw
  2. The PowerShell script get the parameters. Ex:
    $users = $args[0]
    $psw = $args[1]
  3. It opens a WinSCP session as in the attachment.
    At the time of treatment the user SYSTEM does not have the permission in the Temp directory of the system32.
However, I found the solution in another channel of discussions which is to define the locations directly in the script:
session.DebugLogPath = "c:\.... \debug.log"
session.SessionLogPath = "c:\.... \session.log"
session.XmlLogPath = "c:\.... \xml.log"
Most of the information explains how to do it from the interface, except that if we adapt the values from the interface they are not applied when calling from a terminal.

I thank you for your follow up.

Sincerely
Atlas Michael

Reply with quote

martin
Site Admin
martin avatar

Re: Access denied folder C:\Windows\System32\config\systemprofile

Can you please elaborate on the "Call to a TERMINAL, with parameters passage (from an internal application, use user SYSTEM)"?

Is it like scheduling a task to run the PowerShell script using SYSTEM account?

Reply with quote

Advertisement

You can post new topics in this forum