Forum Discussion
Running remote script to write in file share
Thanks for the links.
Well, I've tried the parameters "-scope local", but the issue is just the same. In my case, sometimes runs the first time, sometimes doesn't even run the first time.
Also, I've got that option "Network access: Do not allow storage of passwords and credentials for network authentication" already Disabled, so it's not related to that as well.
Also, if I try to remove the PSDrive with the command Remove-PSDrive <Z> it says the drive does not exist, even when it was created.
Do you think if we create a scheduled task to run the commands will the same issue?
Thanks
No, This is related to a double-hop authentication issue.
if you enable the scheduled task, then the script will be executed from the server itself rather than being called remotely to write to a second hop destination.
- dmarquesgnAug 24, 2022Iron ContributorHi,
Back from vacations, I'm working on this topic again.
In fact creating a scheduled task, we overcome the double-hop authentication issue.
But we face more or less a similar issue. A scheduled task does not like to run script from network shares, but locally they run just fine. So one of the things I need is to copy the ps1 file from the network share to the local server, and that's when I have exatcly the same issue.
I found a workaround which is to create the ps1 file on the local server and add the content to the file, which is fine if the ps1 file is one or two lines, but will be complicated if it's a long ps1 file.
So I'm still trying to find a way to copy the ps1 file to the local server to run the scheduled task after.