You don't say what problem you're encountering when you try to run a script from a UNC path. Could it be you need to modify the ExecutionPolicy?
PowerShell 7.2 script need to run via unc path
how can I add trusted hosts list in the Powershell.config.json file. We need to execute script from UNC path in PowerShell v7.2
Windows for business | Windows Server | User experience | PowerShell
3 answers
Sort by: Most helpful
-
-
Karun Saikia 1 Reputation point
2022-11-07T18:12:49.983+00:00 Error which I am getting is as below
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can
potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the
script to run without this warning message. Do you want to run
\FQDN\DFSroot$\SharedDrive\username\My Documents\PowerShell\Microsoft.PowerShell_profile.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):Due to this warning message, Users are not able to execute the powershell script with parameter. I am not able to found a way to add trusted hosts list in the powershell.config.json file so that I can overcome the above warning message.
-
Rich Matheisen 47,901 Reputation points
2022-11-07T19:15:07.09+00:00 If you look at the file's properties (use File Explorer), is the file blocked? If it's blocked, unblock it.
The error has to with the local computer's trusted sites. It simply means that the file was obtained from an unreliable source. You'd have the same problem if you downloaded a script from a web site.
You can try adding the FQDN of the machine hosting DFS to your computer's Edge browser in its security settings.