Visual Studio 2015 – PowerShell – Github / Perfect Combo

github-logo-300x200First thing first. I started my “Development” career with PowerShell like thousands of peopleout there. Yes I have some unpleasant experiences with Delphi and PHP couple of years ago but PowerShell was the perfect match for me as a infrastructure consultant. It allows to build small and quick automation solutions to help me for my daily tasks.

Over the last couple of years PowerShell evolved and changed a lot. With PowerShell version 5.0 we have now .NET class support! In every release you will feel yourself like a real developer :)

I was looking for the new features coming with version 5.0 and as always checking PowerShell MVP Trevor Sullivan`s blog. I came across with following Channel 9 video he published.

He is talking about PowerShell tools which is an extension for Visual Studio and allows you to develop PowerShell projects within Visual Studio. I strongly recommend above video if you are interested.

As a PowerShell fan, I always wanted to play with Visual Studio as I know that VS is much more powerful than PowerShell built-in ISE. VS provides integration with VS Online, Github (source control), Intellisense and Test Explorer.

Let me tell you how I develop my PowerShell scripts..

I don`t care about best practices or development cycles. I start to develop script from scratch. I try to follow a basic structure but most of the time I find myself lost in the hundreds of lines of codes. I also feel the pain of lack of change tracking, source control in ISE. In a typical week, I may add or change bunch of codes in my script and I`m trying to track my changes by creating manul version folders. Yes I know…It doesn`t work.

So wanted to give a chance Visual Studio and Github integration with PowerShell. Here is a quick requirements of this integration.

  • I installed PowerShell Tools extension for Visual Studio 2015.
  • I installed Github Extension for Visual Studio 2015.
  • Created a new account on Github and created a repository called PowerShell.
  • Logged in my Github account within Visual Studio.


Then followed steps mentioned on

At the end now I can easily create my scripts in Visual Studio using PowerShell Tools extension and then sync them to my Github repository.

For every change in my script, I comment and then commit/sync script to my repository so that easily can track versions.

Looking great!

Read More

PowerShell Function to create colorful menus

I was preparing a PowerShell demo for System Center Universe and decided to use nested menus in order to easily browse between different demo sections. This is how it looks like in action.

Couple of simple loops checks for the inputs and redirects you to the next level/menu.

Creating loops and logic was simple but drawing menus and lines was not easy as I expected. This is what I came up after couple of hours:

Write-Host “╔════════════════════════════════════════════════════════════════╗”-ForegroundColor Magenta
Write-Host “║” -f Magenta -nonewline;Write-Host “UCP Director – API Call – PowerShell Demo Script 1.0” -f Green -nonewline;Write-host “`0`0`0`0`0`0`0`0`0`0`0`0║” -ForegroundColor Magenta
Write-Host “╠════════════════════════════════════════════════════════════════╣”-ForegroundColor Magenta
Write-Host “║” -f Magenta -NoNewline;Write-Host “Please select the admin task you require:`0`0`0`0`0`0`0`0`0`0” -Fore Cyan -NoNewline;Write-host “`0`0`0`0`0`0`0`0`0`0`0`0`0║” -ForegroundColor Magenta
Write-Host “║`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0║” -f Magenta
Write-Host “║” -f Magenta -NoNewline;Write-Host “`t1. Provisioning” -f Yellow -NoNewline;write-host “`t`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0║” -Fore Magenta
Write-Host “║” -f Magenta -NoNewline;Write-Host “`t2. Monitoring” -f Yellow -NoNewline;write-host “`t`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0║” -Fore Magenta
Write-Host “╚════════════════════════════════════════════════════════════════╝`n”-ForegroundColor Magenta

Pretty ugly right? This is why I decided to create a consistent function so that everytime when I want to create a PowerShell menu I can use it.

Hopefully my Basel to London fligth delayed for 2 hours yesterday (!) and I had enough time to code it in airport.

Here is the function on Technet gallery:

Usage is quite simple and in couple of seconds you can have menus like below:



Read More

SCOM SDK – PowerShell – Creating monitor


icon_sdkOne of my customers wanted to monitor a 3rd party solution by monitoring events and asked if it`s possible with SCOM. As you probably know it`s one of the easiest tasks in SCOM to create monitors to monitor events on event viewer for specific or bunch of servers.

I was told to send them instructions to create a monitor based on Windows events. I started to get screenshots from create management pack and create monitor wizards, and then creating a group for the servers need to be monitored and finally overriding my monitor to enable monitoring for this specific computer group. At the end I realized it was about 30 page screenshots. Instead of sending these screenshots I though it would be much easier and sexy to send them a single PowerShell script to create a monitor. I thought SCOM Shell would have these cmdlets.

I was wrong.

Unfortunately, SCOM Shell doesn`t have any supported shell to create a unit monitor for Windows events. Then I decided to check SCOM SDK.

That was the first time for me to deal with SDK with PowerShell. SDK is much more powerful than PowerShell but you need to figure out how to deal with objects and methods.

There is an example to create a unit monitor by using SCOM SDK but as you may realize it`s written in C#. That was a good starting point for me.

So I started my journey, spent couple of hours to create my PowerShell script that uses SCOM SDK binaries. You can find the script below.

Please note that this is really an ugly script, no error handling, structure or sexy functions. This is just a sample to deal with SDK. If you are interested in to learn how to deal with SDK using PowerShell, it`s a good chance to open my script and C# example and see the integration between them.

Also SCOM MVP Tao Yang has done great job with Automating OpsMgr series on his blog .

He also shared with me an article yet to be written regarding monitor creation using SDK. It`s much more better than my ugly script :) So if you need more details, follow Tao`s automation series.

My ugly script:!57641&authkey=!AKbaImed7116Ig8&ithint=file%2cps1


Read More

We will be at System Center Universe 2015 in Basel!

This is my first time to attend System Center Universe in Basel. SCU is an annual conference and brings together the best of Microsoft community speakers and MSFTs to present topics around Microsoft System Center, Azure, Windows Server, Hyper-V and much more.

I`m also very excited as I will be there on behalf of the Hitachi Data Systems. We are traveling to Basel with my four colleagues dedicated for Microsoft virtualization and management solutions in Hitachi.

We will be at our Hitachi booth and will tell the community about why we believe our Hitachi Unified Compute Platform and it`s software management/orchestration layer UCP Director is the perfect solution out there for customers looking for flexibility and seamless integration with Microsoft System Center 2012 R2.

Hitachi`s Unified Compute Platform is a converged solution. All fabric components such as Hitachi servers, Hitachi storage, IP and SAN network are pre-configured and shipped by HDS. When you look at above description you may think it`s just an another converged platform. But it`s not only hardware. UCP Director is the management solution for Unified Compute Platform and offers end-to-end visibility to the entire fabric. It`s a software orchestration layer which is seamlessly integrated with Microsoft System Center Virtual Machine Manager and also vCenter.

UCP Director simply takes responsibility of all vendor specific infrastructure workflows below the hypervisor and provides end to end visibility.


As a gold partner we will also have a 60 minutes break-out session on second day of the event at 09:15. My colleagues and myself will talk about Unified Compute Platform and Hitachi`s strategy regarding the management and orchestration layer. Here are the 3 demos we are planning to show to community in our session:

  • Software Defined Infrastructure with Hitachi UCP – General Overview
  • Provisioning fabric resources of your datacenter with UCP Director
  • Extending Microsoft System Center capabilities with UCP Director

Last demo will show how UCP and its management software UCP Director provides a seamless integration with Microsoft`s System Center suite. I`m planning to demo our SCOM Management Pack, SCO integration and consistent API that can be called easily through PowerShell allows you to orchestrate all your fabric components.

Come and chat with us at our Hitachi booth!

Read More

vTPM in Windows Server 2016 Hyper-V

It`s good to see that there are great security enhancements in the upcoming version of Hyper-V. Containers bring great isoloation for our applications in terms of performance and security.

One another great enhancement is vTPM on Hyper-V. When you enable Hyper-V on Windows Server 2016 or Windows 10, you will see a new security device under Device Manager.



As you may know, Microsoft is using TPM to provide hardware level security for your operating system. TPM is just a chip generally on your motherboard and includes encryption keys in order to create crytographic keys. That allows Bitlocker to use TPM and help to protect Windows OS even it`s stolen or lost..

With the upcoming feature vTPM, now we have same level of security in Virtual Machines. Our VMs can leverage TPM and can be protected by Bitlocker. That means, you don`t need to worry about if someone just gets your VHD and import it into another Hyper-V server. It won`t work..

What about Live migration? According the announcement Live migration will work as usual and traffic will be encrypted.

Read More

Can`t find Hyper-V Manager on Windows 10?

In previous post, I said it`s working so far. But I just checked services and PowerShell cmdlets. When I tried to open traditional Hyper-V Manager, I couldn`t find it under start menu, program files or control panel.

So I tried to add it manually using MMC console snap-ins. Here it is!



Until I found where it is, I will save this snap-in :)


Read More

I have a dream..Consolidated Multi-Hypervisor Management Solution




I have a dream that one day we will be able to manage cross virtualization platforms/cloud types/datacenters through a single pane of glass.


I recently blogged about System Center 2012 R2 Virtual Machine Manager UR6 details. One of the features shipped with UR6 was the ability to manage Microsoft Azure VMs from same VMM console. That`s really great if we are talking about a real hybrid cloud solution. I will not start to compare hypervisors or cloud vendors here. I believe diversity makes us better, stronger. No matter which Hypervisor or Cloud solution you have, upper management requires an ROI and you need to leverage your investment. I do not have luxury to tell you “Hyper-V is better, at least we have same feature set with VMware, let`s drop all your infrastructure and build from scratch with Hyper-V” ….No way..

But even you have some investment on VMWare, you may have some workloads on Microsoft Azure as well. Virtual Machines, Azure Site Recovery, Azure Backup or on-premise Hyper-V VMs for test&development purposes.

People are usually maintaining their current investment in its main hypervisor platform and then starting to onboard additional hypervisors for different purposes (cost, DR flexibility, Public cloud integration etc)

See also below blog post from Chris Wolf:

In this poll, %29 indicated that they are planning to have multi-Hypervisor for production server applications that require DR.

Poll also shows that primary driver for choosing single Hypervisor is DR simplicity. I strongly agree with that. Today we are just talking about management side of having multi-hypervisors. But another challenge is to store applications across different Hypervisors that requires Disaster Recovery.

At MSIgnite2015, VMM team announced additional features come with UR6. For me, one of the most exciting was initial management of VMWare 5.5. Below some management operations that you can achieve with UR6:

  • Add VCenter and ESX Hosts
  • Create VMWare VM Template with basic networking
  • Create VMs from templates
  • Perform VM lifecycle operations on VM
  • Start, stop, shutdown, repair, refresh, checkpoint
  • Connect to VM using console
  • Delete VMs
  • Create Resource Pool and bring under management.

I know these are really initial capabilities when you compare with VMware. There are still vast majority of features need to be added.

But if you see the big picture and read following blogs, you also may dream about to have a unified single management solution across different clouds, datacenters, hypervisors.

Hitachi LPAR – Intel Nested Virtualization Support:

Hyper-V Nested Virtualization Support Announced:

VMM UR6 Azure VM Management:

Who knows, If you are good enough you can see “The Smurfs” as well.

Read More

The Power of Automation


IT automation has always been one of the most important goal of IT managers to make their organization run efficiently. Automation simply ensures that all resources will be allocated according to business needs dynamically.

Hu wrote a post on HDS community where he talked about typical break down of IT budgets.



I also found another diagram on Gartner`s IT metrics report that shows us organizations are spending %66 of their time and budget to just “run the business”

Gartner IT Metric Report

These two diagrams simply show us that in order to grow and transform our business we should focus on innovation and reduce time/money spending on operating. That’s obviously not an easy task to achieve and can only be possible if your infrastructure is flexible and adaptable for these changes.

Couple of years ago, it was a straightforward task for IT administrators to manage/operate less data, servers, and applications. But now, every single minute hundreds of terabytes of data are flowing from “things” to our systems. Since IoT concept will be an enabler to different domains including logistic, transportation, automotive, healthcare and smart cities, in the near future every single “thing” will be sensor attached and connected to the internet/cloud. Analysts expect that 50 to 100 billion devices will be connected to the Internet by 2020.

IT administrators should handle not only this huge amount of data but also underlying components such as storage, network, servers, applications, hypervisors so on.

Unfortunately without having a true software-defined infrastructure approach, managing, maintaining or innovating could be impossible.

As my colleagues Paul Meehan and Paula Phipps mention, to design a software-defined infrastructure approach, we can use three A`s

Automation: 29% of IT time is spent on tedious tasks. 39% of IT outages are due to human error. Hitachi midrange VSP family eliminates tedious manual tasks, reduces errors and lets administrators focus on revenue-generating activities.

Access: Access more data and solve real-world problems

Abstraction: Provide more services faster with more flexibility to support a diverse set of applications.

Couple of years ago I was involved in a project. Customer was working for government and had very sensitive public IIS web sites. Development team was developing updates every two weeks and sending MSI update package to Operations team. This team was responsible to achieve following actions:

  • RDP to different DMZ servers. All servers were belong to different forests therefore they need to use different credential for each server.
  • Copy MSI package to servers, unzip it (No check if MSI damaged/working or not)
  • Call network team and ask them to disable pool member on Load Balancer
  • For each web site, stop IIS service, change webconfig file, install MSI (no check if its installed or not, no check on event viewer or log files)
  • Start IIS service
  • Call network team to revert back configuration
  • Connect another IIS web site….

Operation team was spending around one or two days to update all web servers in production.

But I think time was not the main problem. The main problem was human errors. According the researches, most of the storage, server or service outages are caused by human errors. For the above scenario, if operation guy changes wrong line in webconfig or network guy removes wrong pool member, production environment will have service outage.

However, as using a correct automation method, organizations can easily reduce these statistics and save more money/time.   Remember the first “A” – Automation.

Microsoft is investing in automating, enabling the use of different automation solutions such as PowerShell, System Center Orchestrator and Service Management Automation. These automation solutions can be used to automate not only Microsoft workloads but also cross-platform Linux workloads, Network and Storage solutions.

I believe PowerShell is one of the most important initiatives by Microsoft in recent years. It`s a scripting language with an easy syntax and developed for System administrators. Almost all of the new Microsoft products, on-premise or Azure based, have native Windows PowerShell support.

Orchestrator is the new version of Opalis, acquired by Microsoft in 2009. It`s a process automation solution and comes with System Center suite. If you are using Virtual Machine Manager or Operations Manager you already have an IT Process Automation solution as well. Simple dashboard, drag&drop workflow design. You can also use .NET Script activity to run PowerShell scripts in workflows.

And Service Management Automation built-on PowerShell workflows. It`s a web based process automation tool designed to work with Windows Azure Pack, local version of Microsoft Azure in your datacenter. It allows you to build SMA workflows to create, monitor, deploy and manage resources in your private cloud environment.

When it comes to Software-Defined Infrastructure and Automation, Hitachi offers a wide range of solutions.  The Hitachi midrange VSP family provides the foundation for software-defined infrastructures by making automation and abstraction easy with an integrated portfolio of infrastructure automation and virtualization software.

If you are using Hitachi`s converged solution, you already know that how it simplifies management of private cloud and data center environments. You can also combine Microsoft System Center / Windows Azure Pack suite with UCP and it enables an end-to-end Private Cloud platform with self-service / orchestration / automation capabilities.

This solution automates the management of servers, networking components and storage using UCP Director, System Center and Microsoft adaptors.

Hitachi integrates with Microsoft applications to create a unified automation/management solution for Microsoft environments.

These are the available adaptors provided by Hitachi:

  • Hitachi Infrastructure Adapter for Microsoft System Center Operations Manager
  • Hitachi Adapter for Microsoft System Center Virtual Machine Manager
  • Hitachi Storage Adapter for Microsoft System Center Orchestrator
  • Hitachi Storage Adapter for Microsoft® SQL Server Remote BLOB Storage
  • Hitachi Storage Adapter for Microsoft Windows PowerShell
  • Hitachi Storage Adapter for Microsoft Volume ShadowCopy Service

Especially adapters for PowerShell and Orchestrator enables you to automate and orchestrate processes using together Hitachi and Microsoft solutions.

Hitachi Storage Adapter for Microsoft Windows PowerShell allows Hitachi storage administrators to use PowerShell cmdlets on Hitachi storage systems. Using cmdlets, administrators can create scripts to automate complex tasks.

Hitachi Storage Adapter for Microsoft Windows PowerShell

Using Hitachi Storage Adapter for Microsoft System Center Orchestrator you can easily extend the capabilities of System Center Orchestrator.

Hitachi Storage Adapter for Microsoft System Center Orchestrator

This plug-in provides:

  • Storage management and Hitachi NAS (HNSA) support
  • Virtualized storage management
  • Hitachi Content Platform (HCP) management

Each activity uses built-in PowerShell processes to run on remote server and allows you to create workflows/Runbooks to automate complex tasks in your datacenter.

It`s really good to see how two different vendor come together and built a complete management and automation solution. One more time hats-off to Hitachi engineers. They created really valuable plugins and integrations with Microsoft/System Center suite. These adaptors combines the power of Hitachi performance, reliability and agility with the productivity of Microsoft solutions.

Read More