Forum Discussion
dmarquesgn
Jul 25, 2022Iron Contributor
Running remote script to write in file share
Hi, I'm building a script for checking, downloading and installing updates on Windows Servers, using the PSWindowsUpdate module. My goal is to go to one server a time, check for updates and write a...
farismalaeb
Jul 27, 2022Steel Contributor
I found 2 resource that might help you in your issue
https://github.com/PowerShell/PowerShell/issues/11333
and also check this one
https://support.imanami.com/knowledgebase/article/KA-01005/en-us#:~:text=Go%20to%20Security%20Settings%20%3E%20Local,Click%20Apply%20and%20then%20OK.
dmarquesgn
Jul 27, 2022Iron Contributor
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
- 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. - farismalaebJul 27, 2022Steel Contributor
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.