Hi anonymous user,
As per this and this documents and as shown in below screenshots, Set-CsUser cmdlet doesn't return any output and Grant-CsOnlineVoiceRoutingPolicy cmdlet should return system object output.
I don't have an environment to test out SkypeForBusiness module cmdlets but see if any of the below options resolves the issue.
- Try sending the output of Grant-CsOnlineVoiceRoutingPolicy command to a variable and then write the output after coming out of the session
$session = New-CsOnlineSession -Credential $cred -Verbose
Import-PSSession $session -AllowClobber | Out-NullSet-CsUser -Identity $Identity -OnPremLineURI +$PhoneNumber -EnterpriseVoiceEnabled $true -HostedVoiceMail $false
$Output = Grant-CsOnlineVoiceRoutingPolicy $Identity -PolicyName "Worldwide"Get-PSSession | Remove-PSSession | Out-Null
Write-Output $Output
- Try sending the output of Grant-CsOnlineVoiceRoutingPolicy command to a file in temp location and then get the file's content and write the output after coming out of the session
$session = New-CsOnlineSession -Credential $cred -Verbose
Import-PSSession $session -AllowClobber | Out-NullSet-CsUser -Identity $Identity -OnPremLineURI +$PhoneNumber -EnterpriseVoiceEnabled $true -HostedVoiceMail $false
$Output = Grant-CsOnlineVoiceRoutingPolicy $Identity -PolicyName "Worldwide"
$Output | Out-File -FilePath ($Env:temp+"/OutputFile.txt")Get-PSSession | Remove-PSSession | Out-Null
$OutputContent = Get-Content -Path ($Env:temp+"/OutputFile.txt")
Write-Output $OutputContent