Forum Discussion
Moving users from Skype for Business On-Prem to Teams get-cspowershellendpoint error
Hello!
I am able to move the users from Skype but id like to use the following commands but I keep getting the following errors I'm not sure why.
My script looks like this below.
Up until the "upgrade to teams" part it works fine it does what it's supposed to do.
The last 5 lines give me the following error (second code snippet)
My CSV is really simply it looks like this (third code snippet)
I also tried to add -Identity before $._Dialplan / $_.Region and so on in my code which still does not work.
Any ideas why this won't work?
$Users = Import-Csv “Path to my script.csv”
$sip= $users.SipAddress
Import-Module SkypeOnlineConnector
$session = New-CsOnlineSession -OverrideAdminDomain "mydomain.onmicrosoft.com"
Import-PSSession -Session $session -AllowClobber
Move-CsUser -Identity $sip -Credential $Cred -Target sipfed.online.lync.com -ProxyPool "whatevermypoolis.domain.com" -Confirm:$true
Import-Csv -Path "Path to my script.csv" | ForEach-Object {Grant-CsTeamsUpgradePolicy -Identity $_.SipAddress -PolicyName UpgradeToTeams}
Import-Csv -Path "Path to my script.csv" | ForEach-Object {Grant-CsTenantDialPlan $_.DialPlan -PolicyName DialPlan-Global}
Import-Csv -Path "Path to my script.csv" | ForEach-Object {Grant-CsOnlineVoiceRoutingPolicy $_.Region -PolicyName mypolicyname}
Import-Csv -Path "Path to my script.csv" | ForEach-Object {Grant-CsTeamsCallingPolicy $_.AllowCalling -PolicyName Tag:AllowCalling}
Import-Csv -Path "Path to my script.csv" | ForEach-Object {Set-CsUser $_.Tel -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI "tel:+9999"}
Import-Csv -Path "Path to my script.csv" | ForEach-Object {Get-CsOnlineUser $_.Identity Select-Object UserPrincipalName,DisplayName,EnterpriseVoiceEnabled,HostedVoiceMail,OnPremLineURI,OnlineVoiceRoutingPolicy,TeamsCallingPolicy,TeamsUpgradePolicy}
Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
+ CategoryInfo : InvalidData: (:) [Grant-CsTenantDialPlan], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Rtc.Management.AD.Cmdlets.AssignOcsTenantDialPlanCmdlet
+ PSComputerName : admin1a.online.lync.com
Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
+ CategoryInfo : InvalidData: (:) [Grant-CsOnlineVoiceRoutingPolicy], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Rtc.Management.Xds.GrantOnlineVoiceRoutingPolicyCmdlet
+ PSComputerName : admin1a.online.lync.com
Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
+ CategoryInfo : InvalidData: (:) [Grant-CsTeamsCallingPolicy], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Rtc.Management.Xds.GrantTeamsCallingPolicyCmdlet
+ PSComputerName : admin1a.online.lync.com
Cannot bind argument to parameter 'Identity' because it is null.
+ CategoryInfo : InvalidData: (:) [Set-CsUser], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet
+ PSComputerName : admin1a.online.lync.com
A positional parameter cannot be found that accepts argument 'Select-Object'.
+ CategoryInfo : InvalidArgument: (:) [Get-CsOnlineUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Rtc.Management.AD.Cmdlets.GetOcsUserCmdlet
+ PSComputerName : admin1a.online.lync.com
SipAddress DialPlan Region AllowCalling Tel Identity
name@domain.com Global Myregion Empty 9999 name@domain.com
Audi9112450 OK cool,
I've tidied up and fixed some of the code in your script, the below should work but I haven't gotten to test it our so hopefully no typos in there!
Import-Module SkypeOnlineConnector
$session = New-CsOnlineSession -OverrideAdminDomain "mydomain.onmicrosoft.com"
Import-PSSession -Session $session -AllowClobber
$csv = import-csv "Path to my script.csv"
##Loop through all users in CSV
foreach ($user in $csv) {
##Move User
Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -ProxyPool "whatevermypoolis.domain.com" -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 mypolicyname
Grant-CsTeamsCallingPolicy $user.SipAddress -PolicyName Tag:AllowCalling
Set-CsUser $user.SipAddress -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI "tel:+9999"
Get-CsOnlineUser $user.SipAddress | Select-Object UserPrincipalName, DisplayName, EnterpriseVoiceEnabled, HostedVoiceMail, OnPremLineURI, OnlineVoiceRoutingPolicy, TeamsCallingPolicy, TeamsUpgradePolicy
}
One thing I've noticed, is the name of your VR policy "mypolicyname" or do you need to update that with the VR policy name?
- Audi9112450May 20, 2021Brass Contributor
That is fantastic. I'm going to try it now.
The policy line has a bit of a twist. We have two policies. For the sake of this thread I'll use it as Policy1 and Policy2
Ideally, I would want the script to pick the policy that is in the CSV and apply it. So it would look something like this (see below snippet)
Would I add anything in your cleaned up script for that to work or it should just work out of the box? I probably don't because the script is asking to loop through all the users in the CSV so it should automatically pick everything if I am understanding correctly.
##Grant VR Policy Grant-CsOnlineVoiceRoutingPolicy $user.SipAddress -PolicyName "Policy one" ##Grant VR Policy Grant-CsOnlineVoiceRoutingPolicy $user.SipAddress -PolicyName "Policy two"
Also, I noticed that your cleaned up script is a little different from mine. My CSV has these headers in the columns
A= SipAddress
B= DialPlan
C=Region
D=AllowCalling
E=Tel
F=Identity
Does this have any importance based off your current cleaned up version of my script? Again, as far as I can tell it shouldn't because of this line correct
##Loop through all users in CSV foreach ($user in $csv) {
Thank you a million times over for your help!
- SeanMcAvinueMay 20, 2021MVPOk, I would add in a column for "RoutingPolicy" in your CSV and then change the Routing policy line to:
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- Audi9112450May 20, 2021Brass Contributor
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!
- Audi9112450May 20, 2021Brass Contributor
It's probably just easier to write it clearer since my above post might not be clear.
There are some variables that might exist based on the userExample: User 1 might have "whatevermypool#1" and "Policy1" and User 2 might have "whatevermypool#2" and "Policy2"
Ideally, what I would need is the script to understand that whatever variables are in the CSV to apply them. I think that what it does already but I'm just a bit thrown off by
##Move User Move-CsUser -Identity $user.sipaddress -Credential $Cred -Target sipfed.online.lync.com -ProxyPool "whatevermypool" -Confirm:$true and ##Grant VR Policy Grant-CsOnlineVoiceRoutingPolicy $user.SipAddress -PolicyName Mypolicy