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 “[email protected]” -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 "[email protected]"
    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 "[email protected]" -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!

    My Current Home Network Setup

    After getting Gigabit NBN at home, I thought it was about time to review my home network setup.

    I’d recently bought an Ubiquiti UniFi Dream Machine (UDM) to replace my two ASUS DSL-AC68U‘s which had been a bit prone to freezing, as well as having some other quirks around aiMesh not supporting ethernet backhaul on the model, and the 2.4Ghz mode causing issues around older devices not being able to connect to it when meshed, causing me to create another guest Wifi network that wasn’t meshed… yeah, I was done with them.

    The UDM was a huge step up in features and visibility. I could actually clearly see what devices were on my network, what their signal strength was, an overall health rating of my network, bandwidth used overall and by each device… so much data.

    UniFi Dream Machine – Out of the box but not set up yet.

    It meant I could actually see that at one end of the house, the devices were fine on Wi-Fi , but I wanted as close to perfect as possible. That lead me to buy a Ubiquiti Unifi AP AC Lite to put at one end of the house for better coverage. Adding the access point onto the network was the easiest network thing I’d ever done – plug it in, discover it on the UDM, and that’s it.

    The UDM shows a nice graph of my devices and where they’re connected to (it isn’t aware of non-managed downstream switches though):

    It even has an option to create a floor plan of your house and give recommended settings based on it – you upload an image, draw in the walls and what type they are, run a scan and it gives recommended settings and expected coverage:

    To test my rusty Visio skills (which are still rusty after this), I thought I’d try and draw a topology of my setup. Still not being able to wrangle lines and make them go exactly where I wanted, I think I did an OK job of showing what I have and how it’s connected:

    I’ve actually got a few CAT6 points in the house – from the lounge to a cupboard, and from the cupboard to the family room and one of the bedrooms.

    What I realised out of this was really how many devices I had. I didn’t get close to adding everything in (which was easy to check against the UDM’s client list) – Chromecasts, a Google Mini, other devices that had been offline for a bit or tablets I’d forgotten about – there’s a heck of a lot of devices on the network.

    As my kids get older, and more technology enters our lives, this will continue to get complex. Earlier this year I was still thinking “I’ll never have faster than 100mbit internet” and then gigabit internet came along – making pretty much every device have the ability to get whatever it wants from around the world, at the full speed it’s connected to the rest of my network, rather than having the service running into the house being the bottleneck.

    What’s my real point in all this? I guess just be aware of what you have, what might be actually on your network, and get decent gear if you want to have a good experience. Don’t be afraid to invest in network points in your home, and 5G isn’t going to solve your devices talking to each other in your own home (although I am interested in seeing what real world speeds are like, now that I’ve got coverage).

    With my Gigabit NBN and decent router/access points, the Ubiquiti UDM itself gives a nice summary (and I know we’re 2% short here, it’s as close to perfect as I can get):

    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.

    Synology Diskstation Overview

    After getting an old Synology Diskstation DS1813+ and setting it up, I had Synology reach out to me asking if I’d like to test one of their newer devices and check out it’s Office 365 backup capabilities. I’ll do a separate writeup of how that works, but figured I should start with more of an overview of the Synology Diskstations.

    A Synology Diskstation is a Network Attached Storage (NAS) device which depending on the model, takes up to a certain amount of drives in it which are hot swappable, and no tools necessary to add or remove a drive. They’re quite an elegant solution to having a bunch of disks around. Beyond holding disks (hard drive or solid state) it’s also a server (at least the models I’ve been playing with – some of the smaller end devices might not do this).

    What might you need a NAS for? Virtual machines, backups, multimedia content, CCTV recordings – the same reason you’d have any storage really, but your requirements going beyond a single disk for size, performance or redundancy purposes.

    One of the big selling points of having a Synology Diskstation for me is a special RAID option called Synology Hybrid RAID (SHR). This allows you to have disks of different sizes in your RAID, and still be able to add more disks in the future. Instead of striping the entire disk’s contents across other disks, it breaks it into smaller chunks reducing or eliminating wasted empty space that adding a bigger disk in a standard RAID type would do. Read the link above for a much better explanation than I could give.

    The older 8 bay DS1813+ was rather easy to set up; the video at the top of this post walks you through how to do it. The actual interface to perform the setup after the initial configuration is web based, and feels and drives like a mini OS. You have things like control panel, an app store (called the package center) and even docker to run a bunch of third party solutions in containers.

    You get great visibility on what the device is doing via the Resource Monitor app:

    I’d been slowly migrating data off of two HP Gen8 Microservers that had a bunch of files scattered across several different disks. I’d started with two disks (a 10TB and 6TB) in the DS1813+ in SHR, copied data across, and gradually moved more and more disks in until I had 7 across. I would have had more, but I hit two slight roadblocks: You can’t add a smaller disk than the first smallest disk’s size in a SHR setup (which was 6TB, and I was trying to add a 4TB). I had two of those, but then it turned out one was failing S.M.A.R.T. checks anyway, which I ended up destroying.

    Here’s where I’m up to now – adding a 12TB disk in from slot 8 to the current 30TB capacity storage pool (set up as a single volume), which will bump it up to 40TB usable.

    Anyway, that was all up and running great. I actually had redundancy, and I didn’t have to commit to a particular disk size. Something I’d never had before at home because I was too tight to build my own box, buy a bunch of disks to see myself OK for the next few years, and find the time to build it all up. The Diskstation despite being given to me secondhand ticked all those boxes, and honestly I was about to buy one with my own money anyway.

    Once this was all set up, the new unit from Synology arrived. I set this one up next to the old one for some comparisons – the DS1618+ has more RAM, faster CPU, a USB3 port on the front, an expansion slot for 2x SSDs or 10GB NIC, and 6 disk slots rather than 8, but overall it was pretty similar.

    Synology NAS: On the left: Diskstation DS1813+. On the right: Diskstation 1618+

    These devices run fairly quiet – they’re about 60cm from my head right now and there’s just the slight hum of the fans.

    You might be wondering about the naming convention on what a DS1813+ is compared to a DS1618+ – and I am too, but the DS1813+ is an 8 bay made in 2013, and a DS1618+ is a 6 bay made in 2018. You’ve also got other models like a DS918+ which is actually a 4 bay, but expandable up to 9 with a second unit, also made in 2018. The first 1 or 2 digits is normally what it can scale up to, rather than how many bays are in the model. A full list of models are on Synology’s website.

    I thought I’d try something a bit weird on the DS1618+ to start mucking around with – I put two much smaller 320GB HDDs in it, then added a third 4TB drive to the SHR setup. Despite the older, smaller drives being a lot noisier, it worked. I’ve still only got 586GB capacity, but it shows you can start small and work your way up.

    Synology have a great website for showing how much space you will get for whatever disk combination you throw at it which is worth playing around with.

    I also added a SSD Cache to this setup – the advisor will look at what you have and give a recommended SSD size, but you can use whatever you want. I had a single 60GB SSD spare, so put that in to slot 6.

    It worth noting that if you want a read/write SSD Cache setup, you need two SSDs installed. For read only, just 1 is fine. Although I put this SSD into one of the bays, I could have also bought an expansion card and added two M.2 SSDs to not use up any of the bays. Again, Synology have a lot more details on their website.

    I’m really happy with my setup now, and I won’t have data loss like I had before without any disk redundancy. It’s worth noting that a very large disk can take a few days to add in, and during that time you’d have no redundancy – but you can have a hot spare option or SHR-2 that has two disks for redundancy rather than 1. For that setup you need at least 4 disks, and you can convert a SHR-1 to a SHR-2.

    Next time, I’ll go through the Office 365 Backup features of the Diskstation device (which is free to use!).

    Update 3rd August 2020

    Lars Klint has a video on setting up his DiskStation 920+ which is incredibly similar to the 1618+ setup, so have a watch at a self proclaimed ‘NAS noob’ going through the initial config:

    Residential Gigabit Internet in Australia on NBN

    Back in December 2015, I was connected to the National Broadband Network (NBN) via Fibre To The Premises (FTTP) and wrote about it. It’s taken 5 years for a faster speed to be available to consumers at a reasonable price.

    (This is my personal experience in changing over to Gigabit internet, and is not sponsored or influenced by anyone in any way.)

    Yes – it’s now possible to get reasonably priced, consumer gigabit internet in Australia. That is, if you’re lucky enough to have NBN FTTP or really lucky and in the 7% of the NBN Hybrid Fibre Coaxial (HFC) households.

    You could get faster than 100mbit before this, but only through a few ISPs with 250mbit down but 250/100Mbps was at $250AU per month, and 250/25Mbps at $169AU.

    I’m in that first group, sweet sweet fibre running straight into my premises (or premise?). I was already on 100 megabits per second down, 40 megabits per second up with Internode unlimited for $99AU per month, but Aussie Broadband’s new offering of 1000/50Mbps for $149AU was too good to not try. At worst, I could just go back to Aussie Broadband’s plan identical to Internode’s.

    Changing over to Aussie was the quickest ISP change I’ve ever done. After submitting an online form and providing credit card details, I’d had an alert half an hour later that the service was now active on port UNI-D 1 on my network termination device. I changed the network cable over from one port to the other, checked the settings on my Unifi Dream Machine (UDM) and changed the WAN connection type from PPPoE to DHCP and I was on.

    At the time of signing up, it was still a day away or so from the gigabit plan being released, but speedtest showed I was getting the same as before on a 100/40Mbit plan.

    The next day (May 29th 2020) when the ‘Home Ultrafast’ plan came out, I immediately switched over. Except, my speeds didn’t change. Thankfully, @dawnstarau saved me a lot of time and said to check my UDM settings and look at the Smart Queues up and down rates. After fixing those, I was in the fast lane.

    Unifi Dream Machine Smart Queues settings (correct for 1000/50Mbps)
    First speed test after!

    741Mbps down and 47Mbps up! However, that’s only ~3/4 of a gigabit connection! After a day or so things seemed to speed up a bit more and this is the numbers I’ll normally see:

    877Mbps down. It’s close enough to gigabit on a service that doesn’t guarantee gigabit, and gigabit is the speed that all my wired ethernet devices talk to each other at. For wireless, you’ll need an access point and device on 802.11ac (Wi-Fi 5) to have a chance at gigabit or faster for your devices to talk to each other fast enough – but, my Google Pixel 4 XL that has 802.11ac shows top speeds at around 230Mbps when I’m about 1 1/2 metres away from an access point, way under what my wired devices see.

    How is life on gigabit? Web pages actually do load faster. They weren’t slow in the first place, but things like adverts are noticeably ‘instant’ and an entire page will flash up fully populated, rather than the experience of having a lot of the page load then ads load half a second later.

    Steam downloads a lot faster too, games will peak download around 90Mbps with often around the 50-60Mbps mark. Getting something several times faster makes a big difference when it takes 8 minutes to fully download a large game rather than 45 minutes; it means I’ll happily uninstall a game and get it later if needed, rather than hoarding a giant game ‘just in case’.

    Youtube seems better at quickly detecting HD – even on 100mbit, it would often start at 480p and then work it’s way up to higher resolutions, but now it’s at least 720p.

    Gaming isn’t much different, apart from giant Call of Duty patches which see similar speeds to Steam.

    I don’t mind if two different TVs are streaming YouTube, another’s watching Netflix at 4K and someone wants to online game – the pipe is now big enough that nobody should lessen the experience of anyone else ever. Not that it was really a problem before, but as my kids get older they’ll be doing more and more things online.

    If time is money, then for an extra $50 a month, I think it’s worth it to wait up to 10x less to download something. It’s even better having the flexibility to jump around as there’s no contract, so if I’m having a quiet month I could always just change plans.

    Gigabit is what the NBN’s future promise was at the start until politics got in the way, and it’s really disappointing this option isn’t there for all Australians. Imagine if we did the entire rollout on Fibre and Covid-19 hit. We’d have everyone able to work at home on solid connections, instead of the hybrid mess we have now.

    Also, if you sign up for Aussie Broadband make sure you use a friend code. Both sides get $50 credit – either use my code 3661840 , or even better if you have a friend already on Aussie Broadband, ask them to go to https://my.aussiebroadband.com.au/#/profile/ and tell you their Refer-A-Friend Code.

    Anything you’d like to know or want me to test? Let me know in the comments.