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:

https://gallery.technet.microsoft.com/scriptcenter/Create-colorful-PowerShell-8689c5b2

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

Capture

Cheers!

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.

https://msdn.microsoft.com/en-us/library/hh329086.aspx

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.

https://msdn.microsoft.com/en-us/library/hh329015.aspx

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 http://blog.tyang.org/ .

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:

https://onedrive.live.com/redir?resid=3CAAB02B9CC620D5!57641&authkey=!AKbaImed7116Ig8&ithint=file%2cps1

 

Read More

We will be at System Center Universe 2015 in Basel!

Hitachi_SCU_Logo
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.

eee

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.

vTPM

 

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

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

Martin-Luther-King-I-have-a-dream_0

 

 

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:

http://blogs.gartner.com/chris-wolf/2012/12/11/heterogeneous-virtualization-trends-at-gartner-data-center/

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:

http://blogs.hds.com/hu/2014/09/hitachi-lpars-provide-safe-multi-tenant-cloud-with-intel-e5v3.html

Hyper-V Nested Virtualization Support Announced:

http://www.hyper-v.nu/archives/hvredevoort/2015/05/nested-hypervisor-in-windows-server-vnext/

VMM UR6 Azure VM Management:

http://anilerduran.com/one-more-step-to-hybrid-cloud-scvmm-2012r2-ur6/

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.

https://community.hds.com/community/innovation-center/hus-place/blog/2015/04/23/software-defined-infrastructure-enables-greater-innovation-in-it

 

ITSpending

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.

http://www.hds.com/solutions/virtualization/microsoft-hyper-v/hitachi-ucp-for-microsoft/

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

Linux Integration Services Version 4.0 for Hyper-V

Microsoft continues to invest in cross-platform. A new version of LIS (Linux Integration Services) has been published and brings following features:

http://www.microsoft.com/en-us/download/details.aspx?id=46842&WT.mc_id=rss_alldownloads_all

  • Driver support: Linux Integration Services supports the network controller and the IDE and SCSI storage controllers that were developed specifically for Hyper-V.
  • Fastpath Boot Support for Hyper-V: Boot devices now take advantage of the block Virtualization Service Client (VSC) to provide enhanced performance.
  • Time Keeping: The clock inside the virtual machine will remain accurate by synchronizing to the clock on the virtualization server via Timesync service, and with the help of the pluggable time source device.
  • Integrated Shutdown: Virtual machines running Linux can be shut down from either Hyper-V Manager or System Center Virtual Machine Manager by using the “Shut down” command.
  • Symmetric Multi-Processing (SMP) Support: Supported Linux distributions can use multiple virtual processors per virtual machine. The actual number of virtual processors that can be allocated to a virtual machine is only limited by the underlying hypervisor.
  • Heartbeat: This feature allows the virtualization server to detect whether the virtual machine is running and responsive.
  • KVP (Key Value Pair) Exchange: Information about the running Linux virtual machine can be obtained by using the Key Value Pair exchange functionality on the Windows Server 2008 virtualization server.
  • Integrated Mouse Support: Linux Integration Services provides full mouse support for Linux guest virtual machines.
  • Live Migration: Linux virtual machines can undergo live migration for load balancing purposes.
  • Jumbo Frames: Linux virtual machines can be configured to use Ethernet frames with more than 1500 bytes of payload.
  • VLAN tagging and trunking: Administrators can attach single or multiple VLAN ids to synthetic network adapters.
  • Static IP Injection: Allows migration of Linux virtual machines with static IP addresses.
  • Linux VHDX resize: Allows dynamic resizing of VHDX storage attached to a Linux virtual machine.
  • Synthetic Fibre Channel Support: Linux virtual machines can natively access high performance SAN networks.
  • Live Linux virtual machine backup support: Facilitates zero downtime backup of running Linux virtual machines.
  • Dynamic memory ballooning support: Improves Linux virtual machine density for a given Hyper-V host.
  • Synthetic video device support: Provides improved graphics performance for Linux virtual machines.
  • PAE kernel support: Provides drivers that are compatible with PAE enabled Linux virtual machines.

All these features will be available if using supported Linux/FreeBSD VMs. For a list see:

http://technet.microsoft.com/library/dn531030.aspx

 

Read More