Connecting to Office 365 using PowerShell

A brief set of instructions to connect to Office 365 online services using PowerShell, including Azure AD, Exchange Online, and Skype for Business Online.

Note: If you are behind a proxy server, you will need to follow this in order for this to work: https://www.msdonkey.com/powershell/configuring-powershell-to-work-behind-a-proxy-server/

1. Install the 64-bit version of the Microsoft Online Services Sign-in Assistant: Microsoft Online Services Sign-in Assistant for IT Professionals RTW.
2. Install the Microsoft Azure Active Directory Module for Windows PowerShell with these steps:
○ Open an administrator-level PowerShell command prompt
○ Run the command:

Install-Module MSOnline

Get your credentials and connect:

$creds = Get-Credential
Connect-MsolService -Credential $creds
Get-MsolDomain (to confirm if you are connected to the right tenant)

Note: If your account is 2FA enabled, just use the command: Connect-MsolService and then enter your credentials and 2FA authentication.

I would also highly recommend changing the window title, especially if you connect to multiple tenants. This reduces the chances of making a change on the wrong tenant!

$host.ui.RawUI.WindowTitle = "CustomerX: Production"

If you also want to manage Skype Online:

Download and install the Skype for Business Online Connector module.

To connect to Skype Online:

Import-Module SkypeOnlineConnector
$SkypeSession = New-CsOnlineSession -Credential $creds
Import-PSSession $SkypeSession
Get-CsExternalUserCommunicationPolicy (to test)

To connect to Exchange Online:

$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $creds -Authentication Basic -AllowRedirection
Import-PSSession $ExchangeSession
get-mailbox (to test and verify which tenant you are connected to Skype)
Get-Organizationconfig (useful)

If you need to use your proxy with remote PSSessions, connect as follows:

$proxyOptions = New-PSSessionOption -ProxyAccessType IEConfig
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $creds -Authentication Basic -AllowRedirection -SessionOption $proxyOptions
Import-PSSession $Session

Note: If you have MFA enabled you need to install the old Exchange PowerShell module, see here: https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/mfa-connect-to-exchange-online-powershell?view=exchange-ps

To connect to the Security& Compliance center:

$creds = get-credential
$SccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $creds -Authentication "Basic" -AllowRedirection
Import-PSSession $SccSession -Prefix cc

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $creds -Authentication Basic –AllowRedirection
Import-PSSession $Session
Get-RetentionCompliancePolicy (to test)

See https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-office-365-powershell and https://docs.microsoft.com/en-us/office365/enterprise/powershell/manage-skype-for-business-online-with-office-365-powershell for more information.

Also https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-all-office-365-services-in-a-single-windows-powershell-window

Lenovo Miix 720 business hybrid review

The Lenovo Miix 720 is Lenovo’s latest attempt at creating a business class hybrid device in the mould of the Microsoft Surface Pro 4. Lenovo gets a lot of things right with this version, however there are some nagging issues which you may need to consider before rolling these out in your business, or even buying one for home.

This review is written primarily from the perspective of a business implementation, since that is the target audience for these machines, however many points would equally apply to the home user.

Specs

The units we tested came with a Core i5-7200U CPU, 8GB of RAM, and a 256GB NVMe SSD. Al units come with a 12.0″QHD+ 2880×1920 screen with Gorilla Glass, which is perfectly adequate. The CPU is a dual core Kaby Lake chip, and combined with the RAM and speedy SSD, performance was generally excellent. We suspect this configuration may the sweet spot for many organisations, offering a good balance of cost and performance.

The spec tops out at an i7-7500U with 16GB of RAM, however from the service manual it appears that the RAM is not upgradable, i.e. it is soldered to the motherboard.

For those into numbers, the SSD is a Samsung MZVLV256, unfortunately CyrstalDiskMark did not detect the disk so we were unable to test the performance.

Screen

The unit itself is very similar to the Surface Pro 4 in terms of size and weight. However the screen is slightly smaller (12″ vs 12.3″ on the SP4) due to a wider bezel, which is a little disappointing. The screen is also a fingerprint magnet, and even after using a screen wipe it still had smudges all over it, so much so that someone walking past commented on it even after I had just cleaned it. This is only really apparent when the screen is off however, using in docked mode. It should be noted that any laptop with a very high DPI display will have issues if you want to use the built in display with an external monitor that is not also very high res, you will encounter issues with display scaling. The problem is that different displays will require different scaling settings to appear a comfortable size, however Windows (or to be precise, some applications) do not handle this well. This can result in strange effects, such as:
– Connecting the device to e.g. an HD screen after booting it up when not docked, will result in blurry text in many applications, including Office.
– If you booted up when docked, and then undock the device, some applications will appear tiny. For example the IE11 will be so small as to be unusable. Chrome or Edge are fine.
The solution is to log off and on again whenever docking or undocking, and also using only the external display when docked, otherwise you will have mixed scaling settings and one of the screens will look blurry in some applications.

Kickstand

The kickstand uses Lenovo’s intricate watch band hinge similar to the Yoga 900 and 910, however it only has a hinge present on each side unlike those other models. It works well enough, however it is quite easy to push the device down and the hinge slides backwards. In fact on a smooth table it can slide down to near horizontal when slightly dropped on the table, or when prodded. So it doesn’t provide as much resistance as you might like, certainly less than the SP4 which is more solid.

Reparability

The great thing about Lenovo machines it that the Hardware Maintenance Manuals (HMM) are freely available. The HMM for the Miix 720 (https://download.lenovo.com/consumer/mobiles_pub/miix720-12ikb_hmm_201611.pdf) lists all of the parts which are replaceable, and how to disassemble the device. That Lenovo can achieve this level of reparability in the device the same form factor as the Surface Pro 4 is quite an achievement, and refreshing change from machines that are getting to be neigh on impossible to attempt to upgrade or repair yourself (or indeed, at all – I am looking at you Surface Laptop!).

Ports

The Lenovo has a good selection of ports, with 2 x USB A and 1 USB Type-C. The included power supply provides power over USB-C, which makes for a neat docking solution if using something like the Lenovo USB-C dock, since only a single able is needed for power, video, data and network. However because there is only one USB-C port, this does present a small problem at home or on the move, since if you want to use a USB-C dongle (e.g. to connect HDMI when working from home) then you cannot charge the device at the same time. The Lenovo USB-C travel hub

Keyboard

The keyboard is as good as can be expected from a unit like this. The typing experience is fine, however the right shift key is tiny, a single key wide as opposed to about 2.5 keys wide on most keyboards. This makes touch typing very annoying if you are used to using the right shift key with your little finger, you will hit the wrong key every time and end up doing cursor up instead of shift. This is incredibly irritating and I don’t know why Lenovo decided to change the standard keyboard layout. There are many users commenting on this design in the forum https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/Lenovo-Yoga-710-how-to-remap-reassign-Right-Shift-and-PgUp-keys/td-p/3353608 however it is possible to use Keytweak to change the up arrow to function as shift instead.

The keyboard is also backlit with two levels of brightness, and enabled via the usual FN + Space combination, this is nice in a low light environment.

The other benefit of a device like this, is that if a user spills a drink on the keyboard, instead of writing off the whole machine, you simply swap out the keyboard. So this should balance the potential number of increased breakages due to fragility in other areas compared to a normal clamshell laptop.

Stylus

3 Styli (from bottom to top): Surface Pro 4, Lenovo Active Pen, Lenovo Active Pen 2

The Lenovo 720 comes with the newer Lenovo Active Pen 2, at least in most countries. Some people are reporting on the forum that they have received them with the Active Pen 1, which has no button on the top or Bluetooth functionality, so you should check with your Lenovo rep depending on which country you are in.

Otherwise the Active Pen 2 feels like a nice upgrade from the previous model. In addition to the single AAAA battery that the previous model took, this stylus unscrews in the middle and 2 more tiny watch batteries (319 SR527SW) go in the other end. Somewhat fiddly to replace but they should last a good amount of time. These power the Bluetooth functionality and the button on the top, in fact the button still works even if the pen is in half.

Button batteries for Bluetooth and the top button.

The new stylus is longer than the previous generation, and the additional button at the top is very useful as a PowerPoint remote, functionality it supports out of the box, and it can also be configured to open any app you like. OneNote is the obvious candidate as that is often used for taking hand written notes. The 2 buttons on the bottom are also larger and easier to use, by default the top one is for right click, the bottom one for erase, although this is also configurable. There is a Wacom Pen application for some of the more advanced settings which are not present in the default Windows 10 control panel settings. It is also worth noting that both of these work find in the LTSB version of Windows 10 Enterprise.

The new stylus also supports Wacom’s new Active ES standard, with Windows Ink support and supports up to 4,096 pressure levels compared to 1024 on the Surface Pro 4, so this should be a good tablet for drawing. It does not however support tilt

It is completely spherical as you can see from the photos. This means it rolls exceptionally well, which means it is more likely to get lost by rolling off a table or desk. This issue is largely caused by the fact that Lenovo dropped the pen clip from the pen, in fact if you look at the product pages e.g. at http://www3.lenovo.com/gb/en/laptops/ideapad/miix-series/Lenovo-MIIX-720-12IKB/p/88IPMX70799 you can clearly see the clip on the pen, as per the image below. Some users even reported buying a pen with the clip, however our Lenovo rep said that it was dropped due to quality control issues. There is no pen loop, just an awful plastic dongle which goes into a USB port (and feels like it will break it). This sticks out so much you would not want to put it into a bag with it attached. So with no clip, and no decent pen storage, these things are going to get lost like nobody’s business.

Where’s the pen clip?

Performance

Performance is generally very good. Running the Excel benchmark from http://exceltrader.net/984/benchmark_et-xls-an-excel-benchmark-for-traders/, the 720 performed better than the previous generation Surface Pro 4 and Miix 510, which you would expect from the new Intel chips. Whilst the fan spins up under load, performance was generally good across the board. Below are the test results from a few devices which we had to hand.

Model Fujitsu P702 (i3 2nd gen) Lenovo X240 (i5 4th gen) Microsoft Surface Pro 4 (i5 6th gen) Lenovo Miix 510 (i5 6th gen) Lenovo Miix 720 (i5 7th gen)
CPU i3-2370M i5-4300U i5-6300U i5-6200U i5-7200U
RAM 4GB 8GB 8GB 8GB 8GB
Average 17.25 49.76 71.15 72.99 77.27

Pros

– USB-C port, plus 2 normal USB 3.0 Type-A
– Light, yet sturdy
– Improved pen

Cons

– Noisy fan, hot
– That pen will get lost. A lot.
– Keyboard has a tiny shift key making typing annoying

Overall

What Lenovo have managed to create is a hybrid laptop/tablet, almost identical to the Surface Pro 4, however with more up to date connectivity with USB-C, mil-spec tested, and serviceable parts. That is certainly an engineering achievement. However there are comprises with a smaller screen, poor cooling, noisy fan, and a stylus with a mysterious missing clip. Performance is good however, and all in this would make a decent choice for enabling more flexible working within a business, and it is recommended as long as you don’t mind having a large stock of spare pens. Hopefully in the next iteration Lenovo can iron out some of the issues with this generation, they are certainly close to a perfect business hybrid but not quite there yet. I hope that the next version will have a slightly larger screen with less bezel, a better pen with storage, will be silent, and have sorted out the shift key size. Then I’m sold.

Checking your Office 365 ProPlus version and features for Windows Desktop applications

How to check the version of your Office 365 desktop applications. If you have an Office 365 subscription, either home or business, you will probably be aware that your Office applications are updated from time to time.

Features are added, bugs are fixed, and performance is (hopefully) improved over time. So you may want to know what version you are running, and what the features are of that version.

Checking your Office 365 version

Firstly, you need to check which version of Office 365 you have installed.

  1. Open any Office application, such as Word or Excel, and create a new document.
  2. Choose File, then Account
  3. The version is shown below e.g. 1705

 

There are 2 ways to view the update history for Office 365 desktop, which will tell you which features were added in this version.

 

1  What’s new in Office 365

For Office 365 Subscribers:

https://support.office.com/en-us/article/what-s-new-in-office-365-95c8d81d-08ba-42c1-914f-bca4603e1426?ui=en-US&rs=en-US&ad=US

Or if you are an Office 365 Insider:

https://support.office.com/en-us/article/what-s-new-for-office-insiders-c152d1e2-96ff-4ce9-8c14-e74e13847a24?ui=en-US&rs=en-US&ad=US

These pages give a high level overview of the features added in the various releases. If you scroll down you can see features added in previous releases.

 

2  Update history for Office Insider for Windows desktop

This table is the most useful to see which version you get: https://docs.microsoft.com/en-us/officeupdates/update-history-office365-proplus-by-date

This gives a more detailed list of changes

https://support.office.com/en-us/article/update-history-for-office-insider-for-windows-desktop-64bbb317-972a-4933-8b82-cc866f0b067c

For more information see :

When do I get the newest features in Office 2016 for Office 365?

https://support.office.com/en-us/article/when-do-i-get-the-newest-features-in-office-2016-for-office-365-da36192c-58b9-4bc9-8d51-bb6eed468516?ui=en-US&rs=en-US&ad=US

Also see https://docs.microsoft.com/en-gb/officeupdates/release-notes-office365-proplus to see which version you get depending on your update channel.

Script to stop your screen going blank or PC going to sleep

If you have a PC or laptop at work with settings or policies set to turn the screen off, lock the PC, or go to sleep, you may wish to prevent this from time to time. For example you may need to run a display in an office or shop window, or avoid embarrassment during presentations. On a standalone PC you can easily change the power settings to prevent your PC from going to sleep, but this is not ideal because you have to remember to switch it back again.

In a corporate environment you will likely have group policies enforcing these settings that you are unable to change. Having special GPOs applying to groups of machines is one solution, however this will often be time consuming and complicated to setup in a corporate network with security and change control.

PowerPoint does a good job of preventing the screen or PC from turning off during full screen presentation mode, however you may need to run a browser or other application.

As a side note, Presentation View has been around since Windows Vista days, but it is still present even in the latest Windows 10 build, but unfortunately does not work if you have group policies enforcing your settings. This is a shame as it is very easy to use (Right click on the Start menu, Mobility Centre, Turn on presentation view).

Fortunately, there is another easy way of doing this this that work in Windows 10 and earlier versions back to Windows 7 (you may need to alter the script slightly for earlier versions of Powershell). So here is a way of doing it using a simple script:

Create a new text file in a folder called e.g. keep-alive, and call it keep-alive.ps1.

clear host
#
# Script to keep the PC alive, will prevent screen lock and sleep.
# Works by pressing Print Screen every 60 minutes, side effect is that a screenshot will overwrite the clipboard contents
# Change the color of error and warning text
#
# Valid colours: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
# To see all colours:
# [enum]::GetValues([System.ConsoleColor]) | Foreach-Object {Write-Host $_ -ForegroundColor $_}

$opt = (Get-Host).PrivateData
$opt.WarningBackgroundColor = "DarkCyan"
$opt.WarningForegroundColor = "white"

write-warning "Your PC will not go to sleep whilst this window is open..."
Do {
[void][System.Reflection.Assembly]::LoadWithPartialName(‘System.Windows.Forms’)
[System.Windows.Forms.SendKeys]::SendWait({PRTSC})

Start-Sleep -Seconds 60

} While ($true)

Now create a new file in the same directory called keep-alive.bat and add the following:

powershell.exe -ExecutionPolicy Bypass -File .\keep-alive.ps1

Note that this will work on PCs that have Powershell scripts disabled, since it overrides this setting.

You should now have a folder like this:

 

Run the .bat file and your PC will stay alive whilst the window is open.