Prerequisite Error - Access is denied

%3CLINGO-SUB%20id%3D%22lingo-sub-2251894%22%20slang%3D%22en-US%22%3EPrerequisite%20Error%20-%20Access%20is%20denied%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2251894%22%20slang%3D%22en-US%22%3E%3CP%3EError%3A%3C%2FP%3E%3CP%3EThe%20following%20error%20was%20generated%20when%20%22%24error.Clear()%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20if%20(Get-Service%20MpsSvc*%20%7C%20%3F%7B%24_.Name%20-eq%20'MpsSvc'%7D)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set-Service%20MpsSvc%20-StartupType%20Automatic%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Start-SetupService%20-ServiceName%20MpsSvc%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%20was%20run%3A%20%22Microsoft.PowerShell.Commands.ServiceCommandException%3A%20Service%20'Windows%20Defender%20Firewall%20(MpsSvc)'%20cannot%20be%20configured%20due%20to%20the%20following%20error%3A%20Access%20is%20denied%20---%26gt%3B%20System.ComponentModel.Win32Exception%3A%20Access%20is%20denied%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20---%20End%20of%20inner%20exception%20stack%20trace%20---%22.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2251894%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2258376%22%20slang%3D%22en-US%22%3ERe%3A%20Prerequisite%20Error%20-%20Access%20is%20denied%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2258376%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1016069%22%20target%3D%22_blank%22%3E%40sosayush%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOpen%20the%20PowerShell%20console%20with%20%22Run%20as%20administrator%22%20permission%20and%20run%20the%20commands%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EClick%20on%20the%20%3CSTRONG%3EStart%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%3CLI%3ELook%20for%20%3CSTRONG%3EWindows%20PowerShell%3C%2FSTRONG%3E%20(or%20PowerShell%20Core)%20on%20the%20right%20side%20of%20the%20Start%20Menu.%3C%2FLI%3E%3CLI%3ERight-click%20on%20the%20menu%20item%20and%20choose%20%3CSTRONG%3ERun%20as%20administrator%3C%2FSTRONG%3E.%3C%2FLI%3E%3CLI%3EExecute%20your%20script%20and%20check%20the%20case%20again.%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E
New Contributor

Error:

The following error was generated when "$error.Clear();

          if (Get-Service MpsSvc* | ?{$_.Name -eq 'MpsSvc'})

          {

            Set-Service MpsSvc -StartupType Automatic

            Start-SetupService -ServiceName MpsSvc

          }

        " was run: "Microsoft.PowerShell.Commands.ServiceCommandException: Service 'Windows Defender Firewall (MpsSvc)' cannot be configured due to the following error: Access is denied ---> System.ComponentModel.Win32Exception: Access is denied

   --- End of inner exception stack trace ---".

3 Replies

@sosayush 

 

Open the PowerShell console with "Run as administrator" permission and run the commands again.

 

  • Click on the Start button.
  • Look for Windows PowerShell (or PowerShell Core) on the right side of the Start Menu.
  • Right-click on the menu item and choose Run as administrator.
  • Execute your script and check the case again.

thankyou @Kevin Morgan, this is automated script. Runs while installing exchange server.

@sosayush 

 

Can you confirm that you have logged-in to the server with domain admin user account instead of local admin user account?

 

Also ensure that your server machine is successfully joined with your domain.

 

Also check the below thread if you have not already checked.

 

https://github.com/MicrosoftDocs/OfficeDocs-Exchange/issues/1882