Microsoft

Connecting to Skype for Business Online via PowerShell in a Hybrid Environment

How to connect to Skype for Business Online via Powershell

To connect to Skype for Business Online:

  • Download and install the module from Microsoft

  • Run the following commands in PowerShell:

    Import-Module SkypeOnlineConnector

    $sfboSession = New-CsOnlineSession -UserName “admin@contoso.com” -OverrideAdminDomain “yourtennant.onmicrosoft.com”

    Import-PSSession $sfboSession

    Applies To : Windows 10, Windows Server


    I’ve been caught out by this twice and it’s taken me a while to find the rather simple answer.

    Most instructions give you a pretty simple way to connect to Skype for Business Online (or they’ll just call it Skype for Business). You install the module via executable, downloaded from Microsoft, and then try to run the following PowerShell commands (or some similar variation):

    Import-Module SkypeOnlineConnector
    $sfboSession = New-CsOnlineSession -UserName "admin@contoso.com"
    Import-PSSession $sfboSession

    If you don’t have Skype for Business On-Premises, it should just work. If you DO have it and set up hybrid, you’ll probably get this error:

    Unable to discover PowerShell endpoint URI.
    At C:\Program Files\Common Files\Skype for Business
    Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:155 char:9
    +         throw $resources.DiscoveringEndpointFail
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (Unable to disco...l endpoint URI.:String) [], RuntimeException
        + FullyQualifiedErrorId : Unable to discover PowerShell endpoint URI.

    Or, you might get this error if you managed to get the interactive logon to pop up first and then entered your credentials there:

    Get-CsOnlinePowerShellAccessToken : One or more errors occurred.
    At C:\Program Files\Common Files\Skype for Business
    Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:214 char:28
    +             $accessToken = Get-CsOnlinePowerShellAccessToken @params
    +                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Get-CsOnlinePowerShellAccessToken], AggregateException
        + FullyQualifiedErrorId : System.AggregateException,Microsoft.Rtc.Management.OnlineConnector.GetPowerShellAccessTo
       ken

    There’s a huge amount of potential fixes offered, but for me it was one simple switch, which I found thanks to enterinit.com – use the -OverrideAdminDomain switch.

    Import-Module SkypeOnlineConnector
    $sfboSession = New-CsOnlineSession -UserName "admin@contoso.com" -OverrideAdminDomain “yourtennant.onmicrosoft.com”
    Import-PSSession $sfboSession

    Really easy fix, but the errors really don’t make it sound like this could be your problem. Now the next time I try to connect, I’ll re-read my own blog post to remind me of this switch :)

    Note: I had to connect to this to make a Microsoft Teams change!

    Microsoft Briefing Emails Are Coming

    More Microsoft driven emails will be hitting your user’s mailboxes if you’re a Microsoft 365 Customer.

    The last ones I wrote about were MyAnalytics, and now we have Microsoft Briefings. The first I heard about this was an admin email I received, which I think is a good idea that Microsoft are following, probably from feedback when they rolled out MyAnalytics and many IT Admins were caught unaware:

    So, as you can read above, Microsoft Briefings reads what the users are up to, and presents it to them in hopefully a useful fashion to catch emails they might have missed that sound like they need actioning, will give some ideas on how someone can be more efficient and healthy etc

    I received my first email today, and here’s how it looked:

    I blurred out the email that I’d already actioned, and marked it as completed. Just like MyAnalytics, these emails are only visible by someone who has access to your mailbox – the emails that turn up don’t traverse the internet like other emails; instead, Microsoft are popping them up straight into the mailbox. You won’t find any mailflow trackings of these.

    A user can opt out if they don’t like them, or an admin can follow the documentation to pre-emptively disable this on a user by user basis. There appears to be no org-wide setting to disable, so if you need to disable it, make sure you include it as a provisioning step for new users too. See the update at the bottom of the page.

    There’s also a portal users can use to unsubscribe: https://cortana.office.com/

    Once the magic Microsoft switch is set to ‘on’ for your tenant, users will get an email every day that they have some sort of content to be in the briefings email – if there’s no content, there’s no email.

    Just like MyAnalytics, I recommend communicating this soon to your company that the emails are coming. Some people might not like it, but preparing staff for a something that can help them should help with adoption, rather than an out of the blue starter email.

    I’m keen to see how effective the Briefings emails will be and how much value they provide. I think it’s a good idea, and as long as it works as the box describes, should add value for staff at the start of each day to remind them what they’ve got going on, and potentially pick up something they forgot to action.

    Update 17th June 2020

    Microsoft have listened and acted quickly – you can now toggle this feature on or off at the tenant level. To do so, go to the Microsoft 365 admin center, and under Services > Org settings, the Services tab contains the item ‘Briefing emails (Preview)’. From here, there’s your tickbox to turn it off or on.

    Default Cloud Voicemail Language

    When Cloud Voicemail a.k.a. Azure Voicemail (which replaced Unified Messaging) is activated for a mailbox, a default language is set. This value is known as the ‘promptlanguage’ and according to Microsoft Documentation will be set based on the default language for your organisation in the Microsoft 365 admin center.

    The problem is, that value is ‘English’ and doesn’t define which regional set of English you want – en-US, en-UK, en-AU etc. The full list of language codes is available here.

    With Engish set as the preferred language, Azure Voicemail decides that you must be wanting en-US as your promptlanguage – which you may not actually want. The default voicemail greeting is rather different when set to en-US vs en-UK vs en-AU.

    If you’d like to see what a user has, use the PowerShell command:

    Set-CsOnlineVoicemailUserSettings -identity XYZ@XYZ.COM

    and check the value ‘PromptLanguage’.

    On a per user basis, this value can be changed either by the user themselves at https://mysettings.lync.com/voicemail or by an admin with the PowerShell command:

    Set-CsOnlineVoicemailUserSettings -identity XYZ@XYZ.COM -PromptLanguage en-AU

    This still doesn’t solve the tenant wide problem, or set a default.

    For existing users, we just need to get a list of users and change the promptlanguage setting, which can be done with this set of PowerShell commands (includes connecting to SfBO which can be used for the above command also):

    $sfbsession = new-csonlinesession -username adminaccount@conotoso.com -OverrideAdminDomain contoso.onmicrosoft.com


    Import-PSSession $sfbsession


    $users = Get-CsOnlineuser


    foreach ($user in $users) {set-csonlinevoicemailusersettings -identity $user.userprincipalname -promptlanguage en-AU}

    Note the use of the -OverrideAdminDomain switch, which I learnt from this blog post in case you are having issues connecting to Skype for Business Online.

    This process also may take a long time depending how many users you have, as very roughly it takes about a second per user to change the value.

    This will fix your existing users, but what about new ones? You could have the setting modified set as part of the user creation process, but that’s an extra step and you’d need to wait for Azure Voicemail to be ready – in my experience it’s not a service that’ll be available quickly after enabling. At this stage I haven’t found a way to do it though, so you’ll need to consider adding this configuration as part of user setup.

    If you haven’t even thought about what language you’re using – have a look and try each one, as you might find one that you’re happier with than the US.

    Microsoft Teams Dial In Number Licensing – Conference Bridging

    Microsoft Teams does a bunch of different things. One of those things, is meetings. It does it quite well too, and many more people have started using Microsoft Teams this year. There’s a few different types of meetings (including Live Events) and a huge amount of content available (video) on advice on how to run one.

    However, if you’re not using Microsoft Teams as a full phone system, then meetings are restricted to software based only – you need to use the Microsoft Teams client via browser or full install (on desktop or mobile) to join; there’s no dial in number.

    It is possible to buy licenses to give users the ability to create a meeting that also has dial-in support (called Conference Bridging), as long as you are a Volume or Licensing customer. If you meet the pre-requisites, then this just needs an Audio Conferencing license of some sort, with the standard license being per user (like most other licenses) and several dollars a month. In Australia at the time of writing, a license costs RRP $5.50AU if you already have an E1 or E3 license.

    For companies that have a central set of staff creating meetings on behalf of the company, then buying a small amount of licenses just for those users can be a good way of getting the dial in option to add value and give a rather cheap way of providing a full audio and video conferencing solution.

    A much less common option method of providing a dial in number for Microsoft Teams meetings is using Audio Conferencing pay-per-minute. The way this works is by loading up credits into
    Communications Credits
    , applying the free license to whomever you like, and anyone using a dial-in number starts using those credits. The rates vary wildly based on many scenarios, so you’ll need to check them out for yourself – from less than 10 cents AU upward.

    Quick run through of what to set up – read it all before doing any of it!



    Communications Cred
    its
    Microsoft’s doco explains how to do this rather clearly:

    In the Microsoft 365 admin center > Billing > Purchase Services > Add Ons you can select Communication Credits to add the credits, and you can add credit manually at any time. You can also enable the Auto-recharge option, which will allow automatic account refills when the balance falls below the threshold that you set.

    I couldn’t see that Add Ons category, so searched for “Communication Credits’ under the Purchase Services area, had no results but then saw a link to check the Add-ons category’. On that list I could then see Communication Credits to add. For me in Australia, the minimum was $20.

    The auto recharge option can only be triggered when the amount goes below $50 as a minimum (smallest number the field would accept), but I could recharge for another $20, so that’s a fairly small commitment if you expect minimal usage. I set this when I had $20 in, and it did a double recharge to get over the $50 mark instantly.


    Audio Conferencing pay-per-minute

    You can only get this if you’re a Volume and Licensing customer of Microsoft.

    This was the tricky one to find out, but easy once you know what to ask for. You’ll need to ask your license reseller/LAR for:

    AudioConfPayPerMin ShrdSvr ALNG SubsVL MVL PerUsr , SKU: HUR-00002

    It’s a $0 license, and you may need to say how many licenses (they’re free so go high).

    Once they order it, the licenses should turn up like any other under an enterprise agreement, called “Microsoft 365 Audio Conferencing Pay-Per-Minute”.


    Applying the license

    You can’t just apply the Communications Credits license to a user, as it’ll tell you they need to have an Audio Conferencing plan. You can do both at the same time manually, as long as the user has a Skype for Business Online or Microsoft Teams license.

    If you want to use Azure AD and assign a license to a group you’ll need to tick all three licenses; Communications Credits, Audio Conferencing pay-per-minute, and Microsoft Teams or Skype for Business. It doesn’t matter if members of the group already get part of the license from another group membership, it requires all three to be applied.


    Microsoft Teams Configuration

    There’s not much to do here, you might already be configured and ready to go – but you can check your Conference Bridging settings in the Teams admin center and make sure you’re happy with the default number and options.


    You’re done! It can take a little while for the dial in number to show in the Teams signature when creating a meeting via Outlook – maybe a few hours from my experience.

    You can check the status of your credits in the Microsoft 365 admin center, under Billing > Your Products > Communications Credits (it’ll have the Skype for Business logo).

    Hopefully this helps people that have Teams, but aren’t ready to go to it for a full voice solution yet, while allowing others to dial into meetings (very handy when someone doesn’t have a good internet connection).

    Note: You can see how your credits are being used here:

    1. Sign in to Office 365, navigate to the “Teams admin portal”, then “Legacy Portal” on the left menu.
    2. Navigate to “Reports” on the left menu, then the “PSTN minute pools” tab.

    Stopping Skype for Business Autostarting in Windows 10

    Should be simple, right?

    I installed Skype for Business for Office 365 on my home PC. I had Office 365 ProPlus, and the version of Skype for Business has to match that.

    Worked great, and realising I didn’t want it running all the time on my home PC, I changed the option to ‘Automatically start the app when I log on to Windows’ in the Personal options:

    The next day over the weekend, I noticed that Skype for Business had decided to still launch at login. Weird, so I checked what Task Manager had to say:

    Skype for Business wasn’t even listed. I started mucking around a bit more, ticking the option to automatically start, pressing OK, turning it off, pressing OK, rebooting – but every time, Skype for Business just turned up, like a strange uncle you never invite to dinner but somehow still finds out and turns up every night.

    Maybe it’s in the Startup folder in the Start Menu? Is that still a thing in Windows 10? Yes it is. It’s under C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup – replacing ‘username’ with what you’re thinking you should replace it with. Except, there was nothing there.

    I also checked the standard Run locations in the registry, and then even searched for all instances of lync.exe which is still what runs Skype for Business… no hits that make any sense to it running at startup.

    Of course, my next step is to complain on Twitter:

    Interesting – Skype for Business runs at user login, but it’s not listed in Task Manager > Startup, or in the registry’s Run locations. The app even has ‘run at startup’ turned off. Not in the Start Menu Startup folder either. Don’t understand what’s triggering it…— Adam Fowler (@AdamFowler_IT) April 12, 2020

    No winners in the responses – I checked sysinternaltools autoruns as suggested by Neil Clinch, and Guy Leech had a suggestion on how to completely block lync.exe from running ever, but I still wanted to use Skype for Business.

    My Googling hadn’t fared any results, and I was getting desperate. I actually took a chance and read some answers.microsoft.com threads (which are usually sfc /scannow or unhelpful answers that didn’t read the question properly) and user Daniel Wherle had responded to a thread with my exact problem.

    The answer was a setting called ‘Use my sign-in info to automatically finish setting up my device and reopen my apps after an update or restart’. This is hidden in Windows 10 Settings > Accounts > Sign-in options. It’s down the very bottom:

    After I turned this option off and rebooted, Skype for Business no longer launched at startup. I even launched it manually, and restarted while it was running.

    I turned the setting back on and rebooted, Skype for Business still didn’t autostart – that is, until I ran it with the option on, exited and rebooted.

    It’s worth noting that even after completely exiting Skype for Business, lync.exe still ran in the background. I suspect this is part of the problem, because it also won’t re-open until that task is killed. I don’t have any other Office apps open, and it seems like a common enough problem that others will hit it – maybe with other programs too and this Windows 10 option enabled.

    A strange one, but probably as far as I’ll dig on the issue.

    How to stop Skype for Busines from Autostarting in Windows 10:

    To stop Skype for Business from loading at startup:

    1. In Skype for Business – Options go to the Personal option
    2. Untick ‘Automatically start the app when I log on to Windows’

    3. If that doesn’t work:

    4. Go into Windows Settings > Accounts > Sign-in options.
    5. Click Accounts.
    6. In the Sign-in options section, untick ‘Use my sign-in info to automatically finish setting up my device and reopen my apps after an update or restart’

    Applies To : Windows 10