Remove tollfreeNumber from multiple users

Welcome Forums General PowerShell Q&A Remove tollfreeNumber from multiple users

This topic contains 3 replies, has 3 voices, and was last updated by

4 years, 3 months ago.

  • Author
  • #24315

    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member

    Hello forum,

    I have users in Lync Online and I need to remove the toll-free number from all of the users. I have ran command

    Get-CsUserAcp | Where-Object {$_.AcpInfo -match "PGI"} which gives me the users I need to remove the number from.

    When I tested this on my lab, I tried to remove the tollFreeNumber by:

    Get-CsUserAcp -Identity test.user | Set-CsUserAcp -TollFreeNumbers $null

    Now when I issued that command, console prompted the following:
    Supply values for the following parameters:

    So if those parameters are mandatory when using Set-CsUserAcp, and all of my users have unique passcodes, it seems that there is no way to remove the toll-free numbers from all the users with just one command?

    Does anyone know if this can be done easily or am I forced to just go to the Office365 portal and go through all of the users (many hundreds)

  • #24334

    Topics: 13
    Replies: 4872
    Points: 1,842
    Helping HandTeam Member
    Rank: Community Hero

    -TollFreeNumbers isn't mandatory, but if you specify it, you have to provide a value. The help file suggests it wants an array, so you might try:

    -TollFreeNumbers @()

    Which is an empty array. That's not the same thing as $null.

  • #24381

    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member

    Hello Don,

    Thanks for your reply. The tollFreeNumber is not the problem, the passcode number is as it is unique to all the users.
    I think I'd have to do some kind of scripting and as that is not my strongest suit (and I do not the time at this moment to learn) I think I'm forced to remove these one by one from GUI..

  • #24420

    Topics: 8
    Replies: 1191
    Points: 646
    Helping Hand
    Rank: Major Contributor

    Did you event try what Don suggested? It looks like the TollFreeNumbers is an array of objects containing the TollNumber, ParticipantCode, Domain and Name. If you do:

     Get-CsUserAcp -Identity test.user | Select TollFreeNumbers

    I would expect it would return @{TollNumber=blah;ParticipantCode=blah;Domain=blah;Name=blah} for an object that contains a ParticipantCode. What is returned for a user that has no ParticipantCode? Setting it to @() should set the array of objects to nothing and remove an entries, visually it would look something like this

    $TollFreeNumber = @(

The topic ‘Remove tollfreeNumber from multiple users’ is closed to new replies.