Permission Issues running sfc,chkdsk,dism as job in script??

Welcome Forums General PowerShell Q&A Permission Issues running sfc,chkdsk,dism as job in script??

Viewing 2 reply threads
  • Author
    Posts
    • #254729
      Participant
      Topics: 1
      Replies: 1
      Points: 10
      Rank: Member

      So I’m trying to create a script to run sfc,chkdsk, and dism as a job on the computer. It’s intended to be run on a computer that would be signed in as a standard user so that I can run this at the end of the day when I need to and check the reports after

      I think I’ve got the majority of the script in place already but running into issues when it gets to runing the actual utilities. It tells me that admin privelleges are needed please run in an elevated prompt.

      At the time of testing I was signed in as a local admin on the computer and simply testing out the commands in an admin session of PS so there should be no permission issues. If I remote the -credential parameter from the start-job cmd then the script runs (as I would expect, given that Im signed in as admin).

      Left the commands attached, open to any help/suggestions/opinions. End goal is to be able to run this by double clicking and forgetting about it until the next day, I don’t want to input passwords at all and would like for it to be run by a non-admin computer account.

      ######## *omitted $user and $pass lines
    • #255197
      Participant
      Topics: 6
      Replies: 120
      Points: 129
      Helping Hand
      Rank: Participant

      Try running this and see what you get back from your test.

      [/crayon]
    • #259804
      Participant
      Topics: 1
      Replies: 1
      Points: 10
      Rank: Member

      Hey @Alex, sorry for the late reply!

      When I ran that immediately after my script, I get “Elevated.”

      Also, when I run the job on its own, manually like below, I get no issues, and can retrieve the job and view its results.

      <br />start-job -name SFC2 -ScriptBlock { sfc /scannow } 

       

      When I run it via the script and supplying the credentials to use, it responds with Error 740, Admin privs needed. Still stumped on this I cant seem to figure out where the permissions issue lie.

Viewing 2 reply threads
  • The topic ‘Permission Issues running sfc,chkdsk,dism as job in script??’ is closed to new replies.