Forum Discussion

Audi9112450's avatar
Audi9112450
Brass Contributor
May 18, 2021

Moving users from Skype for Business On-Prem to Teams get-cspowershellendpoint error

Hello gang, 

I am currently trying to move some users from my on prem Skype for Business 2015 server to Teams.

When I select a user and select Move to Teams I am asked to log on to my Office 365 account and when I put my credentials in I am returned the following error. 

I have 2 questions

1) How can I be able to get past this error

2) Is there any way that I can run a powershell command that will automatically do this for me via some kind of CSV file that I can prepopulate with users I want to move?

 

Thanks!

 

 

    • Audi9112450's avatar
      Audi9112450
      Brass Contributor

      SeanMcAvinue 

       

      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

       

       

       

      • SeanMcAvinue's avatar
        SeanMcAvinue
        MVP

        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?

Resources