Monthly Archives: July 2013

Creating a VBScript file Within a VSAE Project

Written by Tao Yang

Not sure if this issue has been blogged before. Yesterday, while I was working on a management pack project, I noticed that if I created a new VBScript file within VSAE (In Visual Studio), the script will not run when I test it in command prompt.

To replicate this issue again, I firstly created a brand new VBScript file inside the project:

image

Then added one line to the script and saved it:

image

Now, when tried to run it via the command prompt, I got a error saying there’s an invalid character at position (1,1) – which is the beginning of the script:

image

This error normally means the encoding for the .vbs file is not set as ANSI, which is exactly the problem in this case. When I opened the VBScript using NotePad++, looks like the script is encoded in UTF-8

image

To fix this issue, I simply changed the encoding to ANSI and saved the VBScript

image

Now it runs perfectly:

image

However, once the VBScript gets updated and saved again within Visual Studio, the encoding will revert back to UTF-8.

I don’t think this issue impacts the finishing piece of the management pack, but will impact developers when testing the script while still writing the MP. The alternative is to create the blank file outside of the Visual Studio and import it in by adding an existing item. I noticed if the file was initially created outside of Visual Studio and later got updated in Visual Studio, the encoding remains as ANSI.

Because of this reason, from now on, I’ll always create the VBScript file outside of Visual Studio when using VSAE.

My 2 Cents to the TechNet Subscription

Written by Tao Yang

If you have been to my blog before, you probably own or at least know what a TechNet subscription is. And you probably have heard about that Microsoft recently announced that they are retiring this offering.

So far the responses within broader IT community towards this are overwhelming.

Personally, I believe there is a very healthy IT community for various Microsoft technologies. People (including those MVP’s) help each other out, share their knowledge and experiences. That’s why I felt that I have learned a lot from the community and decided to start this blog 3 years ago to contribute something back to this wonderful community. Microsoft, on the other hand, has provided wonderful breeding beds for us IT Pros. We, as IT Pros, for an reasonable annual subscription fee, are able to access Microsoft’s software products without any limitations and then are able to to apply what we’ve learnt into our work, effectively making Microsoft more successful.

Although the real reason for killing TechNet subscription is unknown, from talking to people around me, some people think it’s because of software piracy, others think it’s Microsoft trying to push their cloud offering. Regardless if any of these two guesses are correct, I think Microsoft is plain stupid and arrogant!

A friend of mine told me he has personally seen companies using TechNet license keys in production environment. I agree, this is not right, Microsoft has the rights to protect their intellectual properties. But please, don’t punish all of us because there is one (or few) rotten apples in the bucket! People misuse not only software, but also many other things! For example, especially in US of A, there have been many incidents that someone misused weapons in wrong places at wrong time and as the result, many people lost their lives. This is a far more serious issue than software piracy. You don’t see US government ban people from buying and using guns do you! 12 years ago, I lived and worked in USA for a year (internship as part of my university degree). When I was living there, I was told many many times, “Guns don’t kill people, people kill people”. In my opinion, same theory applies here. Killing TechNet is not going to stop those people from using pirated software. They can either get a MSDN subscription and continue on, or download and crack the software from news groups or bit torrent sites. Only because the TechNet subscriptions are being misused by someone doesn’t mean it should be canned!

I agree, cloud computing has a great potential, this is why I have spent a lot of time and got the MCSE Private Cloud certification. But I still think it serves different purposes than having a private lab on premises. No matter what cloud is it, they are all hosted on physical hardware (aka fabric). At moment, I have 4 physical computers in my lab and there are around 40 VMs running on these physical computers. I don’t even want to work out the cost of having them hosted in Azure because I just can’t afford the cost! In addition, there are things that I just can’t test / evaluate in a public cloud environment. One of my colleagues gave me a copy of Cisco Nexus 1000V virtual switch to try in my lab. Maybe one of those decision- makers in Microsoft can advise me how am I supposed to install this using your Azure subscription? In China, where I come from, there’s an old saying: if you hold the sand to tight, you will lose them between your fingers. We all know Cloud computing has a lot of potentials, but please, don’t push it too hard, you will push your customers away!

When I looked at the alternatives suggested by Microsoft, I thought they are taking a piss out of us IT Pros. Please, I’m not a 2 year old, don’t treat me like an idiot!

Here’s what Microsoft has suggested:

TechNet Evaluation Center

like I said earlier, with around 40 VMs and 4 physicals in my lab, it is impossible for me to rebuild them every 30-180 days. Life is too short to keep rebuilding your labs every 30-180 days!

TechNet Virtual Labs and MS Virtual Academy

I might as well just read the “PC for dummies” guide and hope I can progress my career in IT? Speaking with real life experience, My employer owns one of the biggest System Center environments within the region (according to Microsoft), we have invested heavily in OpsMgr. We approached Microsoft and asked them where can we send people to learn Management Pack authoring in Australia. The answer is there is nowhere you can go. So Microsoft or its partner don’t even offer a paid instructor-led training down here, and you are hoping people can learn from your level 100-200 labs online? For those who read my blogs regularly, you know I write management packs and publish them here, free of charge. Without my TechNet subscription, I couldn’t even start learning MP authoring by myself in the first place!

If doing online simulations is good enough to perform your job, those two Korean pilots from Asiana probably wouldn’t crash the plane in San Francisco?!

MSDN Subscriptions

Well, I run the following products in my lab:

  • Windows Server
  • Windows Client (7, 8)
  • SQL Server
  • System Center Suite (everything except DPM)

In order to use all of these products, I will need either a “Visual Studio Premium with MSDN” or “Visual Studio Ultimate with MSDN” subscriptions. and Here’s the costs of these 2 subscriptions in Australia:

image

Hey, If I’m a millionaire, I wouldn’t even be writing this article. To renew my TechNet subscription, I pay around $400 AUD every year and I always renew when there’s a discount promotion code. But if this whole thing is because of Software Piracy, what difference does it make if you make everyone to pay 10 times more than what they used to? People will probably buy a subscription and sell the keys on eBay to get the money back!

TechNet Forums

So I suppose “All theories no practice” is a good thing then?

Come on, Microsoft, you make mistakes every now and then (i.e. Windows Vista, XBox One, Start button in Windows 8). It seems you’ve managed to correct your mistakes eventually. I really hope you soon realise canning TechNet subscription is a stupid mistake before it’s too late! I’m not a business man, but I know that if you have a large customer base, and your products are used by more people, the profit will come. That’s why Toyota makes more money than Ferrari! very simple theory!

Lastly, for the readers, if you care and agree with me, please sign this petition:

http://www.change.org/petitions/create-an-affordable-alternative-to-msdn-subscriptions-comparable-to-technet

Creating a VSAE Project (Solution) Including Multiple Management Packs

Written by Tao Yang

When writing management packs for an application / system, it is very common to have multiple management packs included in the end monitoring solution. i.e. a library MP, a discovery MP, a monitoring MP, etc.

Back in the old days when using the OpsMgr 2007 R2 Authoring console, these separate management packs need to be created separately. If one of these MPs (i.e. the library MP) is referenced in other MPs (i.e. discovery MP and monitoring MP), the referenced MP (i.e. the library MP) needs to be developed and sealed prior to making the references in the referencing MPs (i.e. discovery and monitoring MPs). further more, when the referenced MP gets updated with additional classes or modules, the minimum version number for this reference on the referencing MPs needs to be manually updated and the sealed updated referenced MP needs to be copied to a reference search location that has been defined in the Authoring Console so the referencing MPs can find it.

As you can see, there are a lot of manually steps involved when working on multiple management packs simultaneously, not to mention MP authors will almost always have multiple instances of Authoring Consoles opened, – one instance for each MP.

Now, with VSAE, when developing a rather complex MP project that involves multiple MPs, it is almost a no brainer, none of above mentioned manual steps is required anymore.

Firstly, when start authoring the management packs, MP authors can create a Visual Studio solution which contains multiple projects (each project represents a management pack). To do so, instead of using the Management Pack project templates, a blank Visual Studio Solution needs to be created first.

image

Once the solution is created, each management pack project can be created individually by going to File—>Add—>New Project…

image

And choose the appropriate management pack project template

image

Once all management pack projects are created, all of them will show up in the Solutions Explorer and Management Pack Browser within Visual Studio

image

I can now reference the library MP in the Discovery and Monitoring MP. – without having to firstly write and seal the library MP first. To do so, simply add a reference in the referencing MP:

image

Instead of referencing an existing management pack, the reference can be another project:

image

Whenever the version of the library MP is increased, the reference in the referencing MPs are automatically updated:

i.e. when the library MP is on version 0.0.0.1, the reference property is as below:

image

When the library MP version gets updated to 0.0.0.2, the reference is automatically updated in the referencing MPs:

image

When building the solution in Visual Studio, it will build all the MPs included in the solution, in the appropriate order. Unlike back in the old days, the library MPs will need to be built and sealed prior to other MPs. This is not required anymore.

In conclusion, VSAE provides a single console for MP developers to build multiple MPs as a single solution, and it manages the relationships between these MPs automatically. It ensures the latest version of the referenced MPs are always being used in referencing MPs.