Dir Syncronizing not working


Author
Message
PeterC
PeterC
New Member
New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)
Group: Forum Members
Posts: 3, Visits: 14
Hi
I have a PowerShell script that includes the option to sync directories after the backup.
My problem is when the script is run by the scheduler it does the backup ok but doesn't do the dir sync. When I run the script it works perfectly.
Any ideas why it doesn't run when run by the scheduler?
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 84K
What’s the target of the sync?
PeterC
PeterC
New Member
New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)
Group: Forum Members
Posts: 3, Visits: 14
jphughan - 16 February 2023 1:22 PM
What’s the target of the sync?

\\Tornado\Tornado-X\BuiltImages
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 84K
Ok, I thought that was the case.  Network sessions are per-session in Windows.  When you run your script interactively, Reflect is running in your user session and therefore has access to authenticated network sessions that are open in that session.  But Reflect scheduled tasks run as the SYSTEM account, which is outside your user context and therefore can't use those open connections.  And the SYSTEM account itself is a purely local account, so it has no permissions to any network resources at all.  One option would be to configure scheduled tasks to run under your own user account, but even then scheduled tasks are a separate context from your interactive session, so the way to make that work would be to configure a user on your NAS that has an identical username and password to what you have in Windows, so that the scheduled task user has "implicit" permissions to that network resource. The other option would be to modify the script to actually open an authenticated session to that location before the sync runs, but that will require storing credentials in the script.

PeterC
PeterC
New Member
New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)
Group: Forum Members
Posts: 3, Visits: 14
jphughan - 16 February 2023 5:09 PM
Ok, I thought that was the case.  Network sessions are per-session in Windows.  When you run your script interactively, Reflect is running in your user session and therefore has access to authenticated network sessions that are open in that session.  But Reflect scheduled tasks run as the SYSTEM account, which is outside your user context and therefore can't use those open connections.  And the SYSTEM account itself is a purely local account, so it has no permissions to any network resources at all.  One option would be to configure scheduled tasks to run under your own user account, but even then scheduled tasks are a separate context from your interactive session, so the way to make that work would be to configure a user on your NAS that has an identical username and password to what you have in Windows, so that the scheduled task user has "implicit" permissions to that network resource. The other option would be to modify the script to actually open an authenticated session to that location before the sync runs, but that will require storing credentials in the script.

The NAS does have identical username/passwords as the source PC.
How would I modify the script to open an authenticated session?
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 84K
If you have identical user accounts, the better option would be to configure scheduled tasks to use a user account that is both an administrator on the local system and a valid account on the NAS. To do that, go to Defaults and Settings > Schedule, uncheck the option to use the SYSTEM account, and supply alternate credentials there. Just bear in mind that if you ever change the password for that account, you will need to update the password in Reflect, otherwise scheduled backups will start failing.

Modifying the script would require you to know the appropriate PowerShell syntax or get a step-by-step guide from someone who does. I can’t work on that right now, unfortunately, but that’s a less optimal solution anyway because you’d be storing a password in plaintext within the script:
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Login

Explore
Messages
Mentions
Search