Show or Hide SharePoint List Using CSOM | C# | PowerShell

Disclaimer: This is pretty old topic just remade it using CSOM and PowerShell at my client work place.

During SharePoint due diligence many suggested to use SharePoint Manager Tools, CAML Query Builder etc. It’s better to keep tools handy but gathering and executing the client requirement is better than the best.

Environment: Client has WSS 3.0, MOSS 2007 and SharePoint 2010 platforms, they want to organize the structure and keep the contents similar. An ideal goal is to move to upgraded versions.

During this big discussion development team suggested to make a script which reads the web, site, lists and document library properties and set the same in each farm. Dude! writing script is easy and deploying is very easy as well. But, before we do that let’s know why properties are set differently ? Who made the decision? Business Justification is much more important so I suggested Power Users or SharePoint L1 to decide and deploy the solution.

How? Power Users like GUI based solutions they don’t want to execute console applications or scripts. As usual we picked up a call and I was shocked by listening to content manager requirement – “Need one liner cmdlet and we will create Lists and Set it’s Property. It may be one or many!” It’s that simple PowerShell reached to content managers as well. ๐Ÿ™‚ I was happy because I am going to meet their needs in short span of time!

To kick on the demo in a catchy way. I showed them how PowerShell one liner looks like ๐Ÿ™‚

Get-EvenNumbers -From 1 -To 10

It’s that simple to use, I haven’ t used any validation in this function very simple code which prints the even number using range operators. The function code is below

Function Get-EvenNumbers
    [Parameter(Mandatory = $true)]

    ($From..$To).ForEach({if($_ %2 -eq 0){$_}})
Get-EvenNumbers -From 1 -To 10

Solution for Content Managers:

Consume CSOM and build binary module using Class Library ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ This time I used Visual Studio 2013 just for a change ๐Ÿ™‚

using System;
using System.Collections.Generic;
using System.Text;
using System.Security;
using System.Net;
using System.Management.Automation;
using Microsoft.SharePoint.Client;

public class SetSPListVisibility : Cmdlet
    [Parameter(Mandatory = true)]
    public string SPUrl;

    [Parameter(Mandatory = true)]
    public string SPListName;

    [Parameter(Mandatory = true)]
    public bool ListVisibility;
    protected override void ProcessRecord()
        ClientContext ctx = new ClientContext(SPUrl);
        NetworkCredential credentials = CredentialCache.DefaultNetworkCredentials;
        ctx.Credentials = credentials;

        List list = ctx.Web.Lists.GetByTitle(SPListName);

        list.Hidden = ListVisibility;

Usage (Just for Demo):

Import-Module C:\Scripts\Module\CSOM_Demo.Dll
#Hide the List
Set-SPListVisibility -SPUrl http://weburl -SPListName "PowerShell" -ListVisibility $false

#Show the List
Set-SPListVisibility -SPUrl http://weburl -SPListName "PowerShell" -ListVisibility $true

In next my next blog I will share the complete module! It’s that’s easy ! Happy SharePointing and Enjoy PowerShell ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚

Reason: Content manager need this kind of solution for re usability. Smart Guy!

SharePoint Content Management using PowerShell | Dude! it’s a Due Diligence – Part 1

October-26-2015: Due to SharePoint tasks I missed MVP Summit 2015; Energy drained out due to disappointment!. So, I engaged 16 hours of my time with SharePoint team to perform a due diligence. Traveled in and around Netherlands for consultations with clients, developers and IT Professionals.

Introduction: Though we know each other we gathered at a party lounge for a friendly handshake and a BIER ๐Ÿ™‚ and that’s Hertog Jan a typical Dutch Bier!



Not huge if we are four in numbers to share! – Cheers!!!

Challenge 1: Our security team will not allow us to install any third party components and products not guaranteed by Microsoft. So, we need to code to inventory of SharePoint farm(s). Includes MOSS 2007 & WSS 3.0,ย  SharePoint 2007 and SharePoint 2013.

Challenge 2: Developer team is busy in SharePoint Online training, we can engage them only twice a week.

Challenge 3: We need to plot a blue print of SharePoint farm without third party tools. The same needs to be shared with IT Managers before we design a plan for deployment or migrations or transformations.

๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ Let’s keep the challenges apart. We may come across many while working on the Test and Production environment. So, we decided to get back to work on October-27-2015 with fresh mind! Yeah! we concluded not to work at home or not even to bing for solutions a day prior to work. A fresh mind is most important to work independently!

Requirement 1: Get all the items from Large List – We can see 30,000 + items we need a report in Excel.

I quickly showed the option in ribbon “Export to Excel” ๐Ÿ™‚ “Assuming things will not help at work place!” Clients need Large List items reports to be shared in email and uploaded SharePoint portal. If it’s in portal why in email? To gain customer satisfaction we stopped asking questions, we gathered our tasks and grabbed a cup of coffee to our desk.


oops! That’s not a large list, it’s a Document Library enabled with Document Set! The complete web is built and deployed using custom code. Exploring is not a challenge but need to be handled it with care. Many columns are Interconnected or mapped with multiple lists in the same web.

CAML Query is SharePoint IT Professionals best friend, Just three things we need to do Query, Select Fields, and set Attributes to do this we need a tool; Indeed that will be PowerShell. The mission begins now!


Dude, that’s SharePoint 2010 hosted on Windows 2008 R2 Standard. PowerShell Version 2.0 ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ – Developers Team looked at me and laughed – Do you remember this version? Can we raise a request to upgrade the version of PowerShell? (Nope! PowerShell 4.0 stable version requires some workaround in SharePoint box and PS 5.0 Product Preview is not stable version) shall we do a timer job? (No! No! No! – Folks, don;t forget MOSS 2007 we did many without Shell Mangement – Now, we have a tool to manage!. Go and Check your Visual Studio version and updates – I assume you may need one more Bier!)

Dusted up my old SharePoint script file and modified it as required

Step 1: Export – Items to CSV

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction 0
$spsite = Get-SPWeb -Identity
$splist = $spsite.Lists["Large List"]
$spQuery = New-Object Microsoft.SharePoint.SPQuery
$camlquery = "<Where><Eq><FieldRef Name='FSObjType'></FieldRef><Value Type='Text'>1</Value></Eq></Where>"
$spQuery.Query = $camlQuery
$spQuery.ViewFields = [String]::Concat("<FieldRef Name='Project_Number'/><FieldRef Name='Created'/><FieldRef Name='Editor'/><FieldRef Name='Author'/><FieldRef Name='Number_of_downloads'/>")
$spQuery.ViewAttributes = [String]::Concat("Scope='RecursiveALL'")
$spQuery.ViewFieldsOnly = $true
$spListItems = $spList.GetItems($spQuery)
$collections = @()
Foreach($spListItem in $spListItems)
    $results = New-Object psobject -Property @{
    "Number" = $spListItem["Project_Number"]
    "Created By" = $spListItem["Author"].Split("#")[1]
    "Status" = $SPListItem.ModerationInformation.Status
    "Modified By" = ($spListItem["Editor"]).Split("#")[1]
    "Number of Downloads" = ($spListItem["Number_of_downloads"])
    $collections += $results 
$Collections #| Export-Clixml C:\temp\LargeList_Report.xml

Step 2: Send in email as attachment and close the requirement!

$param = @{
FROM = ""
TO = ""
Subject = "Large List Report"
SMTPServer = "SMTP Server"
Attachment = "C:\temp\LargeList_Report.csv"
Send-MailMessage @param

Requirement 2: We have removed the existing Approval Workflow and lost the track of Content Approved Items – We can get that in search result.

Yes, this time no SharePoint Shell Management, kicked on Windows PowerShell 5.0 Product Preview from my local machine and got the report. Lucky me! the SharePoint document library will not allow duplicate items ๐Ÿ™‚ so, search results returns one URL (customized search page!) and team didn’t reset the Search Index ๐Ÿ™‚ “25% of the tasks completed – Yes, users can search and read contents from the application

The items found in search results URL will be re-processed : Set Content Approval to $true ๐Ÿ™‚

(Get-Content C:\Temp\Large_list.csv).Foreach({
(Invoke-WebRequest -Uri "$_" -UseDefaultCredentials | 
Select -ExpandProperty Links).href | Select -Last 1

Requirement 3: Approve all documents – No need to think about the tasks which are already fired. So, concluded to change moderation status information to approved for the items found in search result.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction 0
$web = Get-SPWeb -Identity ''
$list = $web.Lists["Large List"]
$ids = Get-Content C:\Temp\Approved_Id.txt 
foreach($id in $ids)
    $item = $list.GetItemById($id)
    $item.ModerationInformation.Status = "Approved"
    "Approving Project {0} - Status: {1}" -F ($item["Project_Number"] , $item.ModerationInformation.Status)

Content mangers did a sanity checks and confirmed all set to good! So, it’s time for us to deploy new (or) upgraded solution. Moved to look at developer team. Oops! really pity – a laptop with 4 GB RAM running Visual Studio 2010 in SharePoint Development environment.


It’s lunch time ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ we have few more fun to flow in! Gained energy with BitterBal


Continued discussion with development at lunch and assessed the challenges – We discussed about buying some more time ๐Ÿ™ “My Mind voice: I could have been to MVP Summit 2015!”. That was just a discussion not a conclusion; Post lunch we were back at desk to continue content management automation.

I requested developer to ignore all exiting ๐Ÿ™‚ DOC LIB items and automation tasks. So, they can develop ASP.NET form to map with DOC LIB columns – Yayyyyyy! Now we have Metadata Columns in the library! – Need a coffee! ๐Ÿ™‚

Requirement 4: Deploy the new solutions – Yep deploying new WSP! One liner using PowerShell – Deployment went fine and development team signed off (Will be back into production support as required), But Application didn’t turned up well!

It’s time for us to show the Power of Shell ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚

I expected the below shiny error ๐Ÿ™‚ But I should explain this to IT Managers like “sorry, we are encountering an unexpected error


๐Ÿ™‚ Woot! Go ! Open up SharePoint Management Shell and execute the below piece of code with start and end time parameters – Pipe and fetch the correlation ID. It’s that simple!

Start Time : Grab it from the error screen shot

End Time : Just increase by 1 minute or 2 (Assumption!)

Get-SPLogEvent -StartTime "05/11/2015 11:22:08" -EndTime "05/11/2015 11:23:08" | Where-Object 
{$_.Correlation -eq "8a343106-0d90-492f-a683-dd0fb59c0058"}

“Missing LCID for <Column>” ๐Ÿ™‚ he he he. Missing English and French!

New solution includes new fields which is set to be mandatory; managed term store now need two more language English and French – Dutch is by default!

Okay, I had the service packs binaries so installed English and French Language Packs to confirm the fix- Voila! we were back on track – 45% of the tasks accomplished! Note: If you are in RTM – Download the latest service pack – Extract and Delete any entries in Update folder which is in the year 2013. So, you can install the SharePoint 2010 Service Packs as RTM and upgrade to the current farm build version id required.

We have done only the initial phase of the work. Few more SharePoint 2010 IT Professional tasks are shared below

  1. Update all missing fields.
    • How to find the missing fields? We may have newly added columns ๐Ÿ™‚
  2. Read other list and update the DOC LIB.
    • Dude! it’s Note Field so we have HTML tags Export and Import in PowerShell or editing in DOC LIB using data sheet looks ugly ๐Ÿ™
  3. Approve all the approved items in the DOC LIB.
    • After manipulating the items – Approve the items if it was approved and pending should remain as pending. ๐Ÿ™‚ We haven’t touched workflow
  4. Most of the information are rendering in SharePoint portal by reading Active Directory.
    • Few users left the organization – We need to update author names with common ID (This is interesting ๐Ÿ™‚ )
  5. What happened to LYNC Presence in the SharePoint portal? LYNC Client is upgraded to Skype for Business. Need to investigate further more! May be browser add in!
    • Not my cup of tea though still I will figure out the reason!
  6. Who created the item? Who Modified the same?
    • We sorted this – But will discuss this again!
  7. Read the department of author and update it in the DOC LIB field (This is very interesting task because we need to explore User Profile Service Application)
  8. Complete the content automation – After all set to good we will start the due diligence for migrate the farm to SharePoint 2013. Or, will think about a POC using SharePoint 2016 Technical Preview!
    • I am waiting ! Not, that easy but possible!
  9. Mean while we need to upgrade the Operating System of MOSS 2007 – Since Windows 2003 server has no support we need to upgrade it to Windows 2008 R2 Standard and strictly needs to be in 32 bit.

More real time scripts, SharePoint Developer and IT Professional discussion about PowerShell will be continued in next blog ๐Ÿ™‚


Useful Links for Windows 10 Developers


Please find few useful links for developing Windows Universal Applications in Windows 10.

Whatโ€™s new for developers in Windows 10

Windows 10 and new developer tools provide the tools, features, and experiences powered by the new Universal Windows Platform.

Get started with Windows apps

Build Windows apps now. Windows 10 makes it easier than ever to develop apps for the Universal Windows Platform with just one API set and one app package to reach all Windows 10 devices โ€“ PCs, tablets, phones, and more.

Design UWP apps

A great app starts with a great user interface. Learn how to design a Universal Windows Platform (UWP) app that looks fantastic on all Windows 10-based devices, from phones and tablets to PCs and Surface Hub.

Develop Windows apps

Hereโ€™s the training you need to create Universal Windows Platform (UWP) apps for Windows 10. A UWP app can run on any Windows-based device, including phones, tablets, and PCs. If youโ€™re looking for docs for older Windows app types and previous versions of Windows, youโ€™ll find them here, too.

Publish Windows apps

The new unified Windows Dev Center dashboard lets you publish and manage all of your apps for Windows devices

Create your own ISE Addon using Visual Studio 2013

Windows PowerShell discussion with System Administrators and Developers: Feedback – ISE has no good Add-On’s. Many uses ISE Steroids which is an excellent add-on for PowerShell ISE. We do have script browser and analyzer now.

Comparing ISE with Visual Studio is not fair ๐Ÿ™‚ Why do you want to do that? WMF 5.0 and it’s features are far better than earlier versions. So, indeed PowerShell ISE is also grown up ๐Ÿ™‚

We don’t have commands to meet all our needs in Windows PowerShell so we create a function , Proxy Functions, Workflow, Class or modules for various needs. Similarly, we can create our own add on for ISE. Let us see a quick demo of it using Visual Studio 2013.

We can easily create this using with the available VSIX if not you can opt for WPF Control Library and create a add-on as required by adding Microsoft.PowerShell.GPowerShell. In this article we will make our job easy by using VSIX – Click to download .

Read the documentation and install the VSIX as required. Now, we will create a simple CustomAddon which will insert a code or some string into the current ISE file.

Open Visual Studio 2013 and choose Visual C# and select PowerShell ISE Add-on for VS2013. Name it as required! In our case I have named it as CustomAddOn as shown below


Now open up the UserControl1.xaml.cs code – Just double click it and the below will be the default code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.PowerShell.Host.ISE;

namespace CustomAddOn
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : IAddOnToolHostObject
        public UserControl1()

     <strong>   public ObjectModelRoot HostObject
                throw new NotImplementedException();
                throw new NotImplementedException();

Okay, we have the pseudo code – let’s do some modification and test the ISE add-on to insert a code or some string in ISE. To do that first we need to comment the below lines and just add get and set like shown below

public ObjectModelRoot HostObject
            //    throw new NotImplementedException();
            //    throw new NotImplementedException();

Now, it’s time for us to add the controls and code as required. For, testing let us add a button and trigger an event which inserts code or string in ISE current file.

So, I have added a button in XAML file and the code looks like below

<UserControl x:Class="CustomAddOn.UserControl1"
             d:DesignHeight="300" d:DesignWidth="300">
        <Button Content="Insert Code" HorizontalAlignment="Left" Margin="32,57,0,0" VerticalAlignment="Top" Width="215" RenderTransformOrigin="-0.846,-0.893" Name="code" Click="click_insert"/>


Just make a note – I have made the name of the button as code and created a click event but haven’t did any code for event firing. so, to do that we will jump back to CS file and code as given below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.PowerShell.Host.ISE;

namespace CustomAddOn
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : IAddOnToolHostObject
        public UserControl1()

        private void click_insert(object sender , RoutedEventArgs e)

        public ObjectModelRoot HostObject
            //    throw new NotImplementedException();
            //    throw new NotImplementedException();

Do right click on the CustomAddon in solution explorer and Build your solution then spin up your PowerShell ISE and execute the below piece of code

Import-Module C:\Temp\CustomAddOn\CustomAddOn\bin\Debug\CustomAddOn.dll
$psISE.CurrentPowerShellTab.VerticalAddOnTools.Add("CustomAddOn" , [CustomAddOn.UserControl1] , $true)

๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ Tada! We have our Custom Add on in ISE


In PowerShell we can do the same using below one liner ๐Ÿ™‚


That’s it for now ! We will see more WPF controls and building ISE Add-On’s using Visual Studio 2013!

Cheers! Enjoy PowerShell!

Retrieve Ticket Information – Using Service Desk Plus REST API and PowerShell – Part 1 – Get_Request

Recently I was reading the article Service Desk Plus REST API. Well! yeah not really great for Automation at this point of time but partially served my needs.I love automation so thought of spinning up PowerShell to do few tasks which I perform on daily basis with minimum tool permission. Indeed, service desk plus has reporting feature and can be automated (Personally not interested to deep dive in it). Reporting automation in tool depends on the server hardware / software capacity and tool configuration. Consider Mid level managers and multiple technicians configured reporting for their needs we may fall in performance degradation. Many will do SQL query to pull reports. Do, remember after pulling reports we should work on Excel to make good reports.

What can we do with Service Desk Plus REST API?

  1. Request Operations [We will cover only this part in this blog!]
  2. Notes Related Operations
  3. Work log Related Operations
  4. Change Related Operations
  5. CMDB Related Operations
  6. Technician Related Operations

Let’s start Automating Reporting, to begin with ensure you have below perquisites

  1. Know about your server host name or URL of the tool and the port information – Eg: http://ServerName:<port>
  2. Keep the API documentation handy – we need to refer to this while coding.
  3. Contact your tool admin and get the API key – Do remember if you are a tool admin you can’t generate one for yourself with the same ID.

You can fetch Request Number by querying your SQL DB using PowerShell – Since, we have enough code in the internet we will skip the PowerShell code for retrieving inform from SQL DB.

My first attempt failed because I didn’t read the API documentation ๐Ÿ™‚

REST_API1Ay! it’s doing something! grab the API documentation and follow the instructions. We need to post the operation name and we have got our API key already from tool admin!. Now use the PowerShell code like shown below

$ticketid = ‘Get it manually for now’
$data = Invoke-RestMethod -Uri http://localhost:80/sdpapi/request/$ticketid/ -Method Post -Body $Params

Okay! This gave me what I need ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ XML ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚


To retrieve the status information we need to see the response code like shown below



Okay! let us see the ticket information in PowerShell ISE ๐Ÿ™‚ But! how do we know that information and status are in result and detail node? Simple, see the API documentation of Viewing Request – Example is shown in the below image

REST_API4Cool! We are good to fire the below PowerShell code.


TaDa! The sample output is below


Service Desk Plus documentation time format is human readable format and this is not why? Well! I am not from manage engine team so I have no answer but as a System Admin I can read that as EPOCH time format. So, again do little more code in PowerShell and convert this time format.

“Date and Time Format is {0}” -f (([datetime]’1/1/1970′).AddSeconds([int](1439388404268 / 1000)))


So, I ended up converting it to Short Date String!

(([datetime]’1/1/1970′).AddSeconds([int](1439388404268ย  / 1000)).ToShortDateString())

That’s it for now, in next post we will see exporting multiple requests to XML for our automation demo! Enjoy PowerShell ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚

Bangalore PowerShell User Group DSC Work Shop – July 18, 2015

Bangalore PowerShell User Group DSC Work Shop – July 18, 2015


  • Are you in INDIA?
  • Are you an IT Pro?
  • Are you a Dev?
  • Looking for Automation?
  • IT Manager looking for a bridge between IT Pro’s and Dev’s?
  • Want to learn or know about DEVOPS?

Just 1 day to go!

Bangalore PowerShell User Group announced a Work Shop event to showcase DSC Basics and Advanced topics. Let’s go declarative ! Stop not! @PSBUG opened a gate. Yeah! Book for the workshop and make use of it. Come and explore! Learn and Share!


Microsoft MVP Virtual Conference 2015


This is a great free event that Microsoft and the MVPs are putting on, May 14th & 15th. Join Microsoft MVPs from the Americasโ€™ region as they share their knowledge and real-world expertise during a free event, the MVP Virtual Conference.

The MVP Virtual Conference will showcase 95 sessions of content for IT Pros, Developers and Consumer experts designed to help you navigate life in a mobile-first, cloud-first world. Microsoftโ€™s Corporate Vice President of Developer Platform, Steve Guggenheimer, will be on hand to deliver the opening Key Note Address.

Why attend MVP V-Conf? The conference will have 5 tracks, IT Pro English, Dev English, Consumer English, Portuguese mixed sessions & Spanish mixed sessions, there is something for everyone!

Come learn from the best and brightest in the tech world today. All of the sessions will all be delivered by the Americasโ€™ Region Microsoft MVPs. These MVPs are experts who present at premiere conferences, independent community events and local user groups all over the globe.

This is a technical conference focused on helping attendees to learn and develop skills for everything from everyday technical work to wackier weekend projects. Whether it is on the IT Pro, Dev or Consumer side of things, you can bet that the content of MVP V-Conf will be cutting edge, exciting and relevant.

Be sure to register quickly to hold your spot and tell your friends & colleagues.

The conference will be widely covered on social media, you can join the conversation by following @MVPAward and using the hashtag #MVPvConf.

Start-DSCConfiguration WMF 5.0 Multiple Nodes Issue

I am one among the many beginners in PowerShell Desired State Configuration. Recently I saw the TechNet Forum Post so thought of sharing my experience


The WinRM client cannot process the request. The object contains an unrecognized argument: “JobId”. Verify that the spelling of the argument name is
ย ย ย  + CategoryInfoย ย ย ย ย ย ย ย ย  : MetadataError: (root/Microsoft/…gurationManager:String) [], CimException
ย ย ย  + FullyQualifiedErrorId : HRESULT 0x803381e1
ย ย ย  + PSComputerNameย ย ย ย ย ย ย  : DSC2

How to Produce this in WMF 5.0?
Configuration DesiredStateConfigurationDemo
    Import-DscResource -ModuleName xWindowsUpdate
    Node $computerName
        xHotFix InstallWMF5
            Path = '\\DSC1\C$\DSCShare\Updates\Some.MSU'
            Id = 'KBsomeid'
            Ensure = 'Present'

DesiredStateConfigurationDemo -ComputerName DSC1 , DSC2
Start-DSCConfiguration .\DesiredStateConfigurationDemo -wait -verbose -force

In middle of demo I couldn’t think about anything else. Since few of my clients were eager to get advantages of DSC – So, I just applied configuration using below code – Our Own PowerShell ๐Ÿ™‚

'DSC1' , 'DSC2' | %{Start-DSCConfiguration .\DesiredStateConfigurationDemo -ComputerName $_ -wait -verbose -force}



Upload High Resolution Picture in Exchange Online

Set-UserPhoto Error – Now Solved ๐Ÿ™‚



Proxy method PSWS:
Request return error with following error message:
The remote server returned an error: (413) Request Entity Too Large…
+ CategoryInfoย ย ย ย ย ย ย ย ย  : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException
+ FullyQualifiedErrorId : Microsoft.Exchange.Configuration.CmdletProxyException,Microsoft.Exchange.Management.RecipientTasks.SetUserPhoto

More Information:

Logged an issue in Connect

Refer to the Workaround posted which might have helped some. Unfortunately it didn’t work in WMF 4.0 at all. Recently, I thought of testing the case in Connect to explore some foot prints.


The reason for the error is quite simple – Exchange Online will not allow images greater than 10 KB and 96 x 96

ย Solution:

I tried to upload an image using the below PowerShell Code

Set-UserPhoto "Chendrayan" -PictureData ([System.IO.File]::ReadAllBytes("C:\Temp\TestImage.jpg")) -Confirm:$false
Image Information:

Updated TechNet Article