Kace - Running PowerShell Script from UNC Path

I'm just learning, hoping someone has some insight...

If I run a .ps1 scrip from a UNC path: c:\<path>\powershell.exe -ep bypass -file "\\server\share\<path>\script.ps1"

As the local system, the agent does not appear to have access (permission) to the UNC path. However, If I run it as an account that is an admin on the local machine and has permissions to the UNC path, the script runs, but I get a UAC prompt when that script launches the installer that it's supposed to...

Any Ideas, work-arounds?

Thank you,

0 Comments   [ - ] Hide Comments


Please log in to comment

Community Chosen Answer


the agent is running as system so it cannot login. 

Solution 1 create a readonly share that everyone has rights to, even non-domain users
Solution 2 add a net use command to map a drive letter in your script with credentails to access the schare and run from the drive and then net use /delete when done

net use k: \\server\share\<path> /user:someuser somepassword
on success
c:\<path>\powershell.exe -ep bypass -file "k:\script.ps1"
net use k: /delete

Answered 01/21/2015 by: SMal.tmcc
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity


I would definitely suggest that solution 2 is the more secure option of the two, as solution 1, basically a null session share, leaves the share wide open to absolutely anyone.  What you may wish to consider is programming an EXE that you can call from your script which makes the connection to the share, so that the connection credentials are hidden.
Answered 01/21/2015 by: EdT
Red Belt

Please log in to comment