A positional parameter cannot be found that accepts argument

Roger Roger 7,181 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.

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
Microsoft Teams Development
Windows for business Windows Server User experience PowerShell
Microsoft Teams Microsoft Teams for business Other
{count} votes

Accepted answer
  1. Anonymous
    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

3 additional answers

Sort by: Most helpful
  1. Roger Roger 7,181 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,901 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. Rich Matheisen 47,901 Reputation points
    2025-02-03T03:07:19.43+00:00

    In addition to the answers given by @Anonymous (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.