The Office 365 service requires PowerShell scripting for a number of commands and is built to work with both Microsoft Scripting Guy’s (MSCH) PowerShell scripting language and Microsoft Visual Studio’s C#.
To use PowerShell to enable these scripts to work, you need to install PowerShell 4.0.
The Office Scripting Toolkit, which is used to compile and run PowerShell scripts, can be installed by using the command below.
After the installation of PowerShell 4, you can add this line to your .csproj file: “UsePowerShell 4.1.”
For more information, see PowerShell Basics: Using PowerShell.