Forum Discussion
Moving users from Skype for Business On-Prem to Teams get-cspowershellendpoint error
Grant-CsOnlineVoiceRoutingPolicy $user.SipAddress -PolicyName $user.routingpolicy
If you add two lines as in your post it will set one and then the other for everyone
Hello!
The script seems to be doing most of what it's supposed to be doing with a few things that I may have to tweak / add
Namely
1) I would like it to choose the Skype Pool
In my CSV I added a column called Pool and in my script added the following line (which I am sure is incorrectly formatted)
Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -ProxyPool $user.SipAddress -PolicyName $user.Pool -Confirm:$true
I get the following error when I run the script (which is surely related to the above line)
Move-CsUser : Cannot bind parameter 'ProxyPool'. Cannot convert value "sip:User#2@domain.com" to type "Microsoft.Rtc.Management.Deploy.Fqdn".
Error: "Invalid fully qualified domain name (FQDN).
Parameter name: fqdn"
At "Path to my CSV.ps1":11 char:104
+ ... com -ProxyPool $user.SipAddress -PolicyName $user.Pool -Confirm:$true
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Move-CsUser], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Rtc.Management.AD.Cmdlets.MoveOcsUserCmdlet
User "User#2@domain.com" is homed on-premises in a Skype for Business or Lync deployment. On-premises users can be upgraded to Teams using
Move-CsUser in the on-premises tools. For details, see http://aka.ms/UpgradeToTeams
+ CategoryInfo : NotSpecified: (CN=fa80d5b7-b69...c1a001,DC=local:OCSADUserOrAppContact) [Grant-CsTeamsUpgradePolicy], OnpremUserInvali
dOperationException
+ FullyQualifiedErrorId : GrantPolicy,Microsoft.Rtc.Management.AD.Cmdlets.AssignCSTeamsUpgradePolicyCmdlet
+ PSComputerName : admin1a.online.lync.com
Can not update OnPremLineURI as the user has dirsynced onpremise LineURI.
+ CategoryInfo : NotSpecified: (:) [Set-CsUser], ManagementException
+ FullyQualifiedErrorId : Microsoft.Rtc.Management.AD.ManagementException,Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet
+ PSComputerName : admin1a.online.lync.com
As far as I can tell the error is here
Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -ProxyPool $user.SipAddress -PolicyName $user.Pool -Confirm:$true
Finally, here is how my CSV looks like (sorry for the formatting I couldn't make it neat)
SipAddress DialPlan routingpolicy AllowCalling Tel Identity Pool
john.doe@domain.com Global Policy1 yes 9999 john.doe@domain.com pool1.domain.com
john.doe2@domain.com Global Policy2 Yes 10 john.doe2@domain.com pool2.domain.com
My ultimate goal is to be able to run your above modified script so I can take my users from Skype On-Prem with the values I put inside my CSV (which looks like above) and it takes my users from Skype On-Prem and moves them to Teams.
It looks like it's doing the job, but it probably needs a few small tweaks that I'm missing
Thank you once again for your support!
- SeanMcAvinueMay 22, 2021MVP
Sorry had a busy day yesterday and never managed to get back to this. You shouldnt need -proxypool at all to be honest so you can remove that bit if you like. The reason for your error is because you have the users synced with AD so their line URI comes from AD. In that case you can run the below. With this you should only be required to enter credentials once per CSV.
Import-Module SkypeOnlineConnector $session = New-CsOnlineSession -OverrideAdminDomain "mydomain.onmicrosoft.com" Import-PSSession -Session $session -AllowClobber $csv = import-csv "Path to my script.csv" $cred = get-credential ##Loop through all users in CSV foreach ($user in $csv) { ##Move User Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -movetoteams -Confirm:$true ##Grant Upgrade Policy Grant-CsTeamsUpgradePolicy -Identity $user.SipAddress -PolicyName UpgradeToTeams ##Grant dial plan Grant-CsTenantDialPlan $user.SipAddress -PolicyName DialPlan-Global ##Grant VR Policy Grant-CsOnlineVoiceRoutingPolicy $user.SipAddress -PolicyName $user.routingpolicy Grant-CsTeamsCallingPolicy $user.SipAddress -PolicyName Tag:AllowCalling Set-CsUser $user.SipAddress -EnterpriseVoiceEnabled $true -HostedVoiceMail $true Get-CsOnlineUser $user.SipAddress | Select-Object UserPrincipalName, DisplayName, EnterpriseVoiceEnabled, HostedVoiceMail, OnPremLineURI, OnlineVoiceRoutingPolicy, TeamsCallingPolicy, TeamsUpgradePolicy }- Audi9112450May 24, 2021Brass Contributor
Good day!
Sorry for the delay I haven't been in front of my PC for a few days.
I got the script to pretty much do everything I need it to do except for something new I'd like to add. I want to be able to change the phone number in AD but my script is giving the following error:Set-ADUser : A positional parameter cannot be found that accepts argument '+1#######;ext=####'.The #'s are substituted by an actual phone number and extension.
I have a column in my CSV that is called ADNumber. Below is the line I added to my script:
set-aduser -"telephone number" $user.ADNumberI also tried it this way:
set-aduser -telephonenumber $user.ADNumberWhen I run the above line I get this error:
Set-ADUser : A parameter cannot be found that matches parameter name 'telephonenumber'Thanks!!
- SeanMcAvinueMay 20, 2021MVP
This should do it.
Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -ProxyPool $user.Pool -Confirm:$true- Audi9112450May 20, 2021Brass Contributor
That caused much less errors (very good thing) there is one error which didn't happen on mailto:user1@domain.com
User "User2@domain.com" is homed on-premises in a Skype for Business or Lync deployment. On-premises users can be upgraded to Teams using Move-CsUser in the on-premises tools. For details, see http://aka.ms/UpgradeToTeams + CategoryInfo : NotSpecified: (CN=fa80d5b7-b69...c1a001,DC=local:OCSADUserOrAppContact) [Grant-CsTeamsUpgradePolicy], OnpremUserInvali dOperationException + FullyQualifiedErrorId : GrantPolicy,Microsoft.Rtc.Management.AD.Cmdlets.AssignCSTeamsUpgradePolicyCmdlet + PSComputerName : admin1a.online.lync.com Can not update OnPremLineURI as the user has dirsynced onpremise LineURI. + CategoryInfo : NotSpecified: (:) [Set-CsUser], ManagementException + FullyQualifiedErrorId : Microsoft.Rtc.Management.AD.ManagementException,Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet + PSComputerName : admin1a.online.lync.comDoes something have to be added to the below line?
Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -ProxyPool $user.Pool -Confirm:$trueAlso, is it normal that I have to put my credentials in for every user that it does? Can it be just a one time credential that runs the entire CSV?
Thank you very much!