A positional parameter cannot be found that accepts argument

Roger Roger 6,736 Reputation points
2025-02-02T21:02:21.7733333+00:00

Hi All

I used the following syntax to grant "TempPolicy1" globally. However, I am encountering an error while trying to remove this policy "TempPolicy1" globally Please guide me.

Grant-CsApplicationAccessPolicy -PolicyName "TempPolicy1" -Global

i have used below syntaxes

Grant-CsApplicationAccessPolicy -PolicyName "TempPolicy1" $Null -Global

Grant-CsApplicationAccessPolicy : A positional parameter cannot be found that accepts argument '$null'.  

Grant-CsApplicationAccessPolicy -PolicyName "TempPolicy1" $Null

Grant-CsApplicationAccessPolicy : Cannot bind argument to parameter 'Group' because it is an empty string.

Microsoft Exchange Online
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,805 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,724 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,536 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,616 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Roger Roger 6,736 Reputation points
    2025-02-03T16:57:15.4833333+00:00

    i have used the below syntaxes i am getting the error.

    Remove-CsApplicationAccessPolicy -identity "TempPolicy1" -Global

    Remove-CsApplicationAccessPolicy "TempPolicy1" -Global

    Remove-CsApplicationAccessPolicy -identity "TempPolicy1"

    Remove-CsApplicationAccessPolicy -identity "TempPolicy1" -global $null

    12

    3

    1 person found this answer helpful.

  2. Rich Matheisen 47,586 Reputation points
    2025-02-03T20:46:28.0033333+00:00

    For that last error, you have to remove the policy from any users to which the policy has been assigned. To do that you assign the policy $null to the user. Use the Grant-CsApplicationAccessPolicy to do that.

    The Remove-CsApplicationAccessPolicy cmdlet removes the policy itself.

    1 person found this answer helpful.
    0 comments No comments

  3. Xintao Qiao-MSFT 6,030 Reputation points Microsoft Vendor
    2025-02-03T02:28:48.1633333+00:00

    Hi, @Roger Roger

    According to your description, you want to remove the policy globally.

    You are trying Grant-CsApplicationAccessPolicy, but an error occurs due to the parameter '$Null'. In fact, the “Grant-CsApplicationAccessPolicy” cmdlet does not accept the '$Null' parameter.

    To globally remove a policy, the correct syntax should not include $null. Instead, you should use the Remove-CsApplicationAccessPolicy cmdlet to remove the policy.

    Remove-CsApplicationAccessPolicy -PolicyName “TempPolicy1” -Global
    

    More information can be found Remove-CsApplicationAccessPolicy (MicrosoftTeamsPowerShell) | Microsoft Learn


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

  4. Rich Matheisen 47,586 Reputation points
    2025-02-03T03:07:19.43+00:00

    In addition to the answers given by @Xintao Qiao-MSFT (using the correct cmdlet) when you mix positional and named parameters the positional parameters must precede any named parameters.

    For example:

    Fictional-CmdletName1 -NamedParameter1 "TempPolicy1" $Null -NamedParameter2
    Should be:
    Fictional-CmdletName1 $Null -NamedParameter1 "TempPolicy1" -NamedParameter2
    
    Fictional-CmdletName1 -NamedParameter1 "TempPolicy1" $Null
    Should be:
    Fictional-CmdletName1 $Null -NamedParameter1 "TempPolicy1"
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.