Hi All,
I have a requirement to set up for new sfb online user and then convert to a team Only user.
So I have created the form with multiple inputs and select boxes with OK to execute the task. ( OK-Script part in below)
Q1: Can I call both sfb and Teams commands on the same shell?
Q2: How do I verify sfb online user is sync before running the Teams command?
Q3: How do I remove my admin password from that script?
Q4: is it better to create 2 forms and instruct to run one after 15 -20 min?
-----------------------------------------------------------------------Part of the script----------------------------------
# add sfb online user and convert to Teams only Mode
$Okbutton.Add_Click({
# your compare function comparing the file in $textbox1 against the file in $textbox2
# IF both fields contain a valid file path and name of course ;)
# for demo just output in console
Write-Host "$($objTextBox.Text),$($objTextBox2.Text),$($objTextBox3.Text),$Dialplan,$voiceroutingpolicy"
#Activate voice calling and assign a number to the user
Enable-CsUser -Identity $($objTextBox.Text) -SipAddressType Emailaddress -HostingProviderProxyFqdn 'sipfed.online.lync.com' -DomainController 'xxxx.domain.com'
#Enterprise Voice users only
Set-CsUser -Identity sip:$UserName -LineUri "tel:$($objTextBox2.Text);ext=$($objTextBox3.Text)" -DomainController 'xxxx.domain.com'
\# ADSync to synch the user
Invoke-command -ComputerName yyxx.domain.com -ScriptBlock { Start-AdSyncSyncCycle }
\# *Wait \~15 minutes*
Start-Sleep -s 900
#*Connect to Microsoft Teams with pre-configured user and password*
$User = "xxxx@domain.com"
$PassWord = ConvertTo-SecureString -String "abcd123456" -AsPlainText -Force
$UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PassWord
import-module microsoftteams
Connect-MicrosoftTeams -Credential $UserCredential -AccountId $User
Import-Module MicrosoftTeams -RequiredVersion 2.3.1
Connect-MicrosoftTeams -Credential $UserCredential -AccountId $User
\# Set user account for Microsoft Teams *only* (PowerShell with MicrosoftTeams module >2.3.1 installed)
Grant-CsTeamsUpgradePolicy -Identity $UserName -PolicyName 'UpgradeToTeams'
\# *******************************
\# * Enterprise Voice users only *
\# *******************************
Set-CsUser -Identity $UserName -EnterpriseVoiceEnabled $true -HostedVoicemail $true -Verbose
Grant-CsTenantDialPlan -Identity $UserName -PolicyName $($objListBox1.Text) -Verbose
Grant-CsOnlineVoiceRoutingPolicy -Identity $UserName -PolicyName $($objListBox.Text) -Verbose
})
$Form.Controls.Add($Okbutton)