Support Forums

Running script on UNC as another user

Use this forum to ask questions before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
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.
User avatar
shawnsifford
Posts: 5
Joined: Thu Dec 31, 2015 10:28 am

Running script on UNC as another user

Postby shawnsifford » Fri Jan 08, 2016 3:44 pm

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?
User avatar
davidc
Posts: 4448
Joined: Thu Aug 18, 2011 4:56 am

Re: Running script on UNC as another user

Postby davidc » Fri Jan 08, 2016 4:24 pm

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
David
SAPIEN Technologies, Inc.
User avatar
shawnsifford
Posts: 5
Joined: Thu Dec 31, 2015 10:28 am

Re: Running script on UNC as another user

Postby shawnsifford » Mon Jan 11, 2016 10:30 am

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.
User avatar
davidc
Posts: 4448
Joined: Thu Aug 18, 2011 4:56 am

Re: Running script on UNC as another user

Postby davidc » Mon Jan 11, 2016 11:59 am

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
David
SAPIEN Technologies, Inc.
User avatar
shawnsifford
Posts: 5
Joined: Thu Dec 31, 2015 10:28 am

Re: Running script on UNC as another user

Postby shawnsifford » Mon Jan 11, 2016 12:53 pm

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).
User avatar
davidc
Posts: 4448
Joined: Thu Aug 18, 2011 4:56 am

Re: Running script on UNC as another user

Postby davidc » Mon Jan 11, 2016 3:50 pm

Run PowerShell Studio as the alternate user then press the following icon on the quick access bar:

Execution Policy.png
Execution Policy.png (15.84 KiB) Viewed 8803 times


If the button is not present, go to Options->PowerShell->Change Execution Policy.

Option Change Execution Policy.png
Option Change Execution Policy.png (25.62 KiB) Viewed 8803 times


Let us know what the Execution Policy Manager displays:

PowerShellPolicyManager.png
PowerShellPolicyManager.png (20.21 KiB) Viewed 8803 times


David
David
SAPIEN Technologies, Inc.
User avatar
shawnsifford
Posts: 5
Joined: Thu Dec 31, 2015 10:28 am

Re: Running script on UNC as another user

Postby shawnsifford » Tue Jan 12, 2016 6:58 am

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.
User avatar
davidc
Posts: 4448
Joined: Thu Aug 18, 2011 4:56 am

Re: Running script on UNC as another user

Postby davidc » Tue Jan 12, 2016 11:52 am

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
David
SAPIEN Technologies, Inc.
User avatar
shawnsifford
Posts: 5
Joined: Thu Dec 31, 2015 10:28 am

Re: Running script on UNC as another user

Postby shawnsifford » Tue Jan 12, 2016 12:21 pm

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.
User avatar
davidc
Posts: 4448
Joined: Thu Aug 18, 2011 4:56 am

Re: Running script on UNC as another user

Postby davidc » Tue Jan 12, 2016 3:12 pm

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.

Elevation Setting.png
Elevation Setting.png (7.97 KiB) Viewed 8746 times


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.

Return to “Trial Software Questions”

Who is online

Users browsing this forum: No registered users and 1 guest

cron