PowerShell Toolkit

Page

 

What is the PowerShell Toolkit for Outlook Live

It’s and abstraction layer that integrate ability to run PowerShell Commands and have many methods in order to manage your Domain/Accounts Live or OnPremise.

You must understand that this project was writing originally for LIVE@EDU

The PowerShell Toolkit for Outlook Live is here

I ADDED A CLASS IN ORDER TO CONNECT AND DISCONNECT USING METHODS

All My samples are based in this Class, but you must understand that when you connect to a PowerShell Session it will take some time, you must optimize your code to keep open execute your procedures and close it. The limit of Connections is 3, so be careful

using System;
using System.Configuration;
using System.Security;

namespace Microsoft.LiveAtEdu.Samples.Powershell
{
   
public class Sessions
   
{
       
public static SessionRunspace _rn;
       
public static SessionRunspace ConnectMe()
       
{
           
SecureString secureString = new SecureString();
           
foreach (char c in SPass) secureString.AppendChar(c);
           
secureString.MakeReadOnly();

            _rn = SessionRunspaceFactory.CreateInstance(
           
SessionType.OutlookLiveSession,
               
SUser, secureString,
                "https://ps.outlook.com/powershell/"
);
           
return _rn;
       
}

        public static bool DisconnectMe()
       
{
           
try
           
{
               
_rn.CloseInstance();
               
return true;
           
}
           
catch (Exception)
           
{
               
return false;
           
}
       
}

        #region Props

        /// <summary>
       
/// Gets the s user.
       
/// </summary>
        public static string SUser

       
{
           
get
           
{
               
return "admin@domain.com";
           
}
       
}

        /// <summary>
       
/// Gets the s pass.
       
/// </summary>
        public static string SPass

       
{
           
get
           
{
               
return "YourPassword";
           
}
       
}

        #endregion
   
}
}

BUT BEFORE YOU MAY WANT TO READ THIS

Windows PowerShell is a command-line shell and scripting language that you can use to manage your organization (Outlook Live domain).

Windows PowerShell uses administrative tasks called cmdlets. Each cmdlet has required and optional arguments, called parameters, that identify which objects to act on or control how the cmdlet performs its task. You can combine cmdlets in scripts to perform complex functions that give you more control and help you be more efficient.

You can use Windows PowerShell on a local computer to connect to your Outlook Live organization and perform management tasks that aren’t available or practical in the Web management interface. For example, you can create dynamic distribution groups, create or update many user accounts at one time, and script automated solutions.

Below are list of things you will need to take care of to run the code snippets or use the C# Outlook library discussed.

Install Windows Management Framework.

This will install Windows PowerShell 2.0 and WinRM 2.0 required to manage Outlook Live domain remotely. At the time of writing this paper, details and download for Windows Management Framework are available at http://support.microsoft.com/kb/968929.

System.Management.Automation.dll is copied to Global Assembly Cache when Window Management Framework is installed. This dll is referenced to perform PowerShell tasks from C#.

Install and Configure Windows PowerShell

At the time of writing, instructions to configure Windows PowerShell are available at http://help.outlook.com/en-us/140/cc952756.aspx. Below is quick snapshot of what needs to be configured.

Enable scripts to run in Windows PowerShell. You can do this by running the following command: Set-ExecutionPolicyRemoteSigned

net start winrm

winrm set winrm/config/client/auth @{Basic="true"}

net stop winrm

Verify that WinRM allows Windows PowerShell to connect to Outlook Live. Configure WinRM to support basic authentication. Run the below commands to do this.

LIVE DOCUMENTATION

Details on Windows PowerShell scripting

http://technet.microsoft.com/en-us/library/bb978526.aspx

Reference to PowerShell cmdlets for Outlook Live

http://help.outlook.com/en-us/140/dd575549.aspx

How to install and configure Windows PowerShell?

http://help.outlook.com/en-us/140/cc952756.aspx

General Outlook Live help

http://help.outlook.com

CSV parser script to create users in Outlook Live

http://help.outlook.com/en-us/140/cc713521.aspx?ref=search

Dynamic Distribution Groups

http://help.outlook.com/en-us/140/cc546291.aspx

Portal Code

http://code.msdn.microsoft.com/liveateduxplore

PowerShell Code

http://code.msdn.microsoft.com/psoutlooklive/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s