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.

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

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

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.

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

🙂 🙂 🙂 🙂 🙂 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?

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 🙂



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


I tried to upload an image using the below PowerShell Code

Image Information:

Updated TechNet Article

Microsoft Ignite 2015

Microsoft Ignite May 4-8, 2015.


This is year Microsoft is conducting Ignite at Chicago, IL. The official Link is here.

Why Ignite?




Registration Link

Explore the contents for Windows PowerShell

We can build our own schedule. Refer to this link and plan your agenda in upfront.


Query AD and Update SQL Express Table Using PowerShell


Query AD [Active Directory] computers and insert into SQL Express.


Requirement is just an one liner. We need to consider a lot before we deliver this to production.

  • Do we need all computers from AD or just enabled? Yeah! We need only enabled computers. If Admin disables / enables a computer or remove / adds a computer in AD the SQL express table should update accordingly.
  • Do we need only client operating systems? Yeah! We need this is for Client OS reporting.


To summarize the requirement customer needs a solution which should do the below tasks.

  • Insert if new Computer found in AD.
  • Drop if computer is removed.
  • Update properties if any change identified.


  • Query AD with Filter ON [Enabled -eq $true and OperatingSystem -eq ‘Windows 7 Enterprise’].
  • Insert If exists.
  • Drop Row if SQL Express rows doesn’t match AD value.[Removed from AD but exists in SQL table]
  • If new computer found insert into table.

PowerShell Code


Exploring LYNC Contacts Using PowerShell

Exploring LYNC Contact folders using PowerShell.

Get-MailboxFolderStatistics will display all the folders information in users mailbox. So using this we can explore LYNC Contacts with the folder type ‘Quick Contacts’.

Lync Contact Folders with 0 EntriesLync Contact Folders with 0 Entries

If we delete lync contacts programmatically it may appear as GUID as well. Like shown below.

2Underneath Contacts we can see two GUID – That’s LYNC and GAL Contacts

Refer this article to remove LYNC contact entries using PowerShell and EWS

How to Explore all folders?