views:

189

answers:

3

Hi,

Does anybody know why I can't access the folder where my powershell scripts are in windows 2008 Ent. When I try to create a script with textpad it craps out. When I try and execute a c# powershell app, which is stored on another win 2003 drive, it craps out with an access exception as well. I've set powershell execution policy to unrestricted for both normal users and admin users with 'run as admin' on powershell, but it doesn't seem to make a difference. There must be a policy setting, doesn't allow scripts access to a directory, but where, and how to set it.

Any help would be appreciated.
scope_creep

A: 

Where is the error coming from: The script itself (nothing is run) or from a command in the script (script starts running)?

Process Monitor could help determine what resource you are having a problem with.

Richard
A: 

It's not entirely clear from your question so I'll go ahead and ask (although I'm fairly sure the answer is yes). Have you started up a new shell and typed

set-executionpolicy remotesigned

If so, what is displayed when you type this? Also what error message is displayed when you try and run a script?

JaredPar
This is what I have.PS C:\Users\Administrator> Get-UnrestrictedPS C:\Users\Administrator>Here is the code.using (StreamReader sr = new StreamReader(PowershellScriptBase + "\\" + "script1.ps1")) { while ((line = sr.ReadLine()) != null) { final+=line; } sr.Close(); } try { PSParser.Tokenize(final, out error); }
scope_creep
Its unrestricted. The access exception is {"Access to the path 'E:\\WorkingDirectory\\Powershell\\script1.ps1' is denied.
scope_creep
When I try to create an script.ps1 file in the c:\scripts directory with textpad it craps out, with an errors.
scope_creep
+1  A: 

I managed to find an answer. I think it was something to do with inherited permissions. Creating the scripts on the referenced directory instead of copying them from the old ntfs directory worked. Thanks for the help. Bob.

scope_creep