Running script on UNC as another user
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
- ShawnSifford
- Posts: 5
- Last visit: Wed Mar 06, 2024 6:37 am
Running script on UNC as another user
If I launch Powershell Studio 2015 as myself and load a script that is stored in a UNC path I can get it to run. If I launch Powershell Studio 2015 as a different user and load a script that is stored in a UNC path I cannot get it to run even though the settings between the two users are the same. I get "File \\server.domain\scriptname.ps1 cannot be loaded. The file \\server.domain\scriptname.ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details". I have tried unrestricted and bypass for the shell execution policy. If I run the script using Run in Console it does run. Ideas?
Re: Running script on UNC as another user
Can you edit and save the file using the alternate user?
Note: You might have to set the executable policy for both x86 and x64 versions of PowerShell. Go to Options->PowerShell->Change Execution Policy. A window will pop up that will allow you to set the policy for both versions of PowerShell.
David
Note: You might have to set the executable policy for both x86 and x64 versions of PowerShell. Go to Options->PowerShell->Change Execution Policy. A window will pop up that will allow you to set the policy for both versions of PowerShell.
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- ShawnSifford
- Posts: 5
- Last visit: Wed Mar 06, 2024 6:37 am
Re: Running script on UNC as another user
Yes, I can edit and save the script as the other user.
I have changed the execution policy for both 32 and 64 bit. I have tried unrestricted as well as bypass.
I have changed the execution policy for both 32 and 64 bit. I have tried unrestricted as well as bypass.
Re: Running script on UNC as another user
I have a few more questions for you:
1. What OS are you running?
2. What version of PowerShell do you have installed? If you have V3 or greater installed, verify that you are not running the script in V2 mode.
3. Can you run the script if you copy it locally? Make sure the script location is accessible to the alternative user.
Note: Sometimes Group Policies can impose restrictions on particular users.
David
1. What OS are you running?
2. What version of PowerShell do you have installed? If you have V3 or greater installed, verify that you are not running the script in V2 mode.
3. Can you run the script if you copy it locally? Make sure the script location is accessible to the alternative user.
Note: Sometimes Group Policies can impose restrictions on particular users.
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- ShawnSifford
- Posts: 5
- Last visit: Wed Mar 06, 2024 6:37 am
Re: Running script on UNC as another user
Windows 7
Powershell V2
I can run it locally. The script on the UNC path is available to the alternate user. I can run it from there with Powershell and PowerGUI.
The error I am getting is about it not being signed.
File \\server.domain\path\script.ps1 cannot be loaded. The file \\server.domain\path\script.ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details
If I run a local script with just the cmdlet Get-ExecutionPolicy as the contents it returns RemoteSigned if I just run it (F5) but returns Unrestricted if I run it in the console (Ctrl+Shift=F5).
Powershell V2
I can run it locally. The script on the UNC path is available to the alternate user. I can run it from there with Powershell and PowerGUI.
The error I am getting is about it not being signed.
File \\server.domain\path\script.ps1 cannot be loaded. The file \\server.domain\path\script.ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details
If I run a local script with just the cmdlet Get-ExecutionPolicy as the contents it returns RemoteSigned if I just run it (F5) but returns Unrestricted if I run it in the console (Ctrl+Shift=F5).
Re: Running script on UNC as another user
Run PowerShell Studio as the alternate user then press the following icon on the quick access bar:
If the button is not present, go to Options->PowerShell->Change Execution Policy.
Let us know what the Execution Policy Manager displays:
David
If the button is not present, go to Options->PowerShell->Change Execution Policy.
Let us know what the Execution Policy Manager displays:
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- ShawnSifford
- Posts: 5
- Last visit: Wed Mar 06, 2024 6:37 am
Re: Running script on UNC as another user
Interesting. Setting it by the red button at the top now works as long as it is set to Unrestricted. However Bypass gets the same error as before.
Re: Running script on UNC as another user
You can get this error if your script was downloaded from the internet or if ran from a UNC path (even if it was not downloaded from the internet). This Scripting Guy article tells you how to get around this issue:
http://blogs.technet.com/b/heyscripting ... ctory.aspx
David
http://blogs.technet.com/b/heyscripting ... ctory.aspx
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- ShawnSifford
- Posts: 5
- Last visit: Wed Mar 06, 2024 6:37 am
Re: Running script on UNC as another user
I already have the UNCAsIntranet setting set. Thus the reason I don't have any issues running scripts from UNC paths in either Powershell or PowerGUI as stated before. The only problem I am having now is running one from a UNC in Powershell Studio as another user. It is now running in Unrestricted but when set to Bypass it still won't run. In Unrestricted it prompts with the security warning asking if I want to run the file which is more than a little annoying when developing. In my environment my main user account has no rights/privileges. I have a secondary account for administration. All scripts have to be developed and run under that second script. Also our virtual desktops have little to no free space so I must keep all of my data on network drives. So I must develop scripts on UNC paths while running under alternate credentials. I am really liking this software but this will be a deal breaker for us here.
Re: Running script on UNC as another user
We have been trying to reproduce this on our end but have been unable to. Unfortunately we do not know what group policies or local settings you may have that affect this and don't have access your system to determine the cause for Windows and/or PowerShell restricting your access.
If you haven't already, you might want to try running the scripts using elevation and see if that makes a difference.
Note: PowerShell Studio runs the scripts out of process, so if you have any policies that require permissions, then these external processes will need to be included as exceptions:
C:\Program Files (x86)\Common Files\SAPIEN Debugger 2015
Since the PowerShell engine is restricting access, I would highly recommend contacting the Microsoft PowerShell team. They can provide insight to the inner workings of the PowerShell engine.
David
If you haven't already, you might want to try running the scripts using elevation and see if that makes a difference.
Note: PowerShell Studio runs the scripts out of process, so if you have any policies that require permissions, then these external processes will need to be included as exceptions:
C:\Program Files (x86)\Common Files\SAPIEN Debugger 2015
Since the PowerShell engine is restricting access, I would highly recommend contacting the Microsoft PowerShell team. They can provide insight to the inner workings of the PowerShell engine.
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.