none
Access denied running powershell.exe RRS feed

  • Question

  • I have dozens of windows server 2012 servers running powershell scripts fine

    For whatever reason a couple of them just wont run my new script, I found out why.. Whenever I run powershell AS "DOMAIN\User" it just says "Access denied"

    What would cause this? I even tried giving the specified user directory access and still no go


    Monday, March 31, 2014 9:11 PM

Answers

  • If the script works correctly, you're asking your question in the wrong place. This forum is really for asking scripting questions.

    In general, I would recommend using the -file parameter to run a PowerShell script; e.g.:


    powershell.exe -file d:\path\scriptname.ps1

    Other than that I would recommend asking your question in a platform forum, such as "Windows Server 2012 General" or "Windows Server General".


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Guldaen Wednesday, April 2, 2014 9:25 PM
    Wednesday, April 2, 2014 9:18 PM
    Moderator

All replies

  • Keep in mind that we have only the information you have provided. We don't have access to your network or your servers, and we can't see your screen.


    -- Bill Stewart [Bill_Stewart]

    Monday, March 31, 2014 9:20 PM
    Moderator
  • Fair enough, basically both servers are Server 2012, both users have same permissions, powershell is the same version, both are set to remotesigned and both scripts are setup identically. Also both have same UAC setting.

    Settings:

    DOMAIN\Backupuser \ Highest Priv \ Run if logged in or not \ Config for 2012 

    Action;

    Program: powershell

    Add Arguments: \\shares\netlogon\backup.ps1

    Start in; \\shares\netlogon

    ------------------

    Everything looks identical, yet one server runs it fine the other returns "Incorrect Function. (0x80070001)". If I try to open powershell with any domain user (including a domain admin) it says "access denied). So I know this is related to the problem.

    -John

    Tuesday, April 1, 2014 5:33 PM
  • Settings for what? Task scheduler? Returns the error message where? To the console? To the event viewer?

    Again, remember that we have only the information you've provided, and we can't see your screen.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, April 1, 2014 5:55 PM
    Moderator
  • Yes, settings for task scheduler. (0x80070001) is the error task scheduler gives me

    For troubleshooting I tried to open powershell (run-as) the domain user and I get access denied. I tried it with my domain admin account and also got access denied.

    I also noticed after changing a few settings the task manager error changed top "The operation completed successfully" (yet no results happen). The script I am using is working on 6-7 other servers so I know its not how it is coded.

    Here are a few screenshots for clarification:

    

    Wednesday, April 2, 2014 9:13 PM
  • If the script works correctly, you're asking your question in the wrong place. This forum is really for asking scripting questions.

    In general, I would recommend using the -file parameter to run a PowerShell script; e.g.:


    powershell.exe -file d:\path\scriptname.ps1

    Other than that I would recommend asking your question in a platform forum, such as "Windows Server 2012 General" or "Windows Server General".


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Guldaen Wednesday, April 2, 2014 9:25 PM
    Wednesday, April 2, 2014 9:18 PM
    Moderator
  • From what you are posting it looks like this is not a scripting issue.  It appears that you cannot run anything without an access denied.

    You are also still being very vague about what it is you are doing.

    Try this.  Create a script with pretty much nothing in it.  Just to a directory listing. save it to s folder on the C drive.

    # script
    get-childitem

    That is all. Run that as a task.  If it works then you are having issues somewhere else.  If it doesn't work you have a broken system.


    ¯\_(ツ)_/¯

    Wednesday, April 2, 2014 9:20 PM
  • I have tried this and I think you are right, this is Windows question more than a scripting question.

    powershell runs fine when I open it locally, if I try to run-as a domain account it won't let me.

    Thanks for your help i'll the Windows Server General forum

    Wednesday, April 2, 2014 9:25 PM
  • I have tried this and I think you are right, this is Windows question more than a scripting question.

    powershell runs fine when I open it locally, if I try to run-as a domain account it won't let me.

    Thanks for your help i'll the Windows Server General forum

    You have a non=-functional trust between the machine and the domain.  Either you have clock issue or routing issues.

    Try rejoining the machine to the domain.  Post in Windows OS forum if you need further help.


    ¯\_(ツ)_/¯

    Wednesday, April 2, 2014 9:37 PM