Archive for November, 2012

New Visio Stencils for Office 2013 Suite

November 30th, 2012 No comments

Nearly ten days back Microsoft did release the Visio stencils for The New Office, which includes Office, Exchange, Lync and more. The stencil contains around 300 icons. Here is the download link.

A view of the 300+ icons

So download and have a look, it contains all that you need to visually represent your new Exchange, Lync, Sharepoint Architectures and Overviews.  There are even icons for New Phones and Tablets,


I spend a little time on this and drew my lab overview which I am currently working on. Below you can find a representation of the same.


Enjoy the New Office and New Windows!

Categories: General Tags:

PSMag PowerShell Brain Teaser: finding list of active IP Addresses of Local Machine

November 28th, 2012 No comments

Today i read the brain teaser winner announcement at Powershell Mag, that I am the winner of the last week’s Brain Teaser. And the same is announced in next Brain Teaser post here :


Here is the description of the last brain teaser:


And my solution was this:

The cmdlet gives a complete IPAddress Object(s):


There are other options as well, a  nice one mentioned by Mike F. Robbins is [Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces().GetIPProperties().UnicastAddresses|% Address - read the post at PSMag for a complete list of answers and comments.

I am happy to be the winner, and awaiting for the book “Powershell 3.0 First Look” to give it a try.


I would like to expand this post to share my learning from participating in this brain teaser, below I will make note of the same.


How to find Members of a DotNet Class from Powershell:

[Net.DNS] | Get-Member – This gives the members of the host’s Runtime

lets try this:  [Net.DNS] | Get-Member * -Force

This is still showing Runtime Members

Now lets try this, this must work: [Net.DNS] | Get-Member -Static

Note: There are obsolete methods for Net.Dns class which are recommended to be avoided by Developers, not sure should it be followed in Powershell as well.

System.Net.DNS Class:

According to MSDN:

Provides simple domain name resolution functionality.

The Dns class is a static class that retrieves information about a specific host from the Internet Domain Name System (DNS).

The host information from the DNS query is returned in an instance of the IPHostEntry class. If the specified host has more than one entry in the DNS database, IPHostEntry contains multiple IP addresses and aliases.

Few Methods of interest from this class:

  • [Net.DNS]::GetHostAddresses()¬† – Returns IP Addreses for the specified host.
  • [Net.DNS]::GetHostByName() – Obsolete. Gets the DNS information for the specified DNS host name
  • [Net.DNS]::GetHostByAddress() – Obsolete. Creates an IPHostEntry instance from IP Address
  • [Net.DNS]::GetHostEntry() – Resolves an IP address or Hostname to an IPHostEntry instance
  • [Net.DNS]::GetHostName()¬† – Gets the host name of the local computer
  • [Net.DNS]::Resolve() – Obsolete. Resolves a DNS host name or IP address to an IPHostEntry instance


You can check the overload definition (What parameters, and how to pass them) which can be found by executing the Method without the parenthesis


Examples of few useful static methods from Net.Dns class:


This method gives all the IP Address (IPv4 and IPv6) assigned to the machine right now.

Even this “[net.dns]::GetHostAddresses($null)” will work for local machine.



This method gives All the IP Address list of the machine provided by Name or IP Address.

It gives similar output as GetHostAddresses.

If the host name or IP Address provided cannot be found an error is thrown.



This is a simple method, it just gives you  the local machine name.

Its very useful, I was trying to get a cmdlet for this to stop using hostname.exe

In all these cases we can run them on remote machines as well by using Powershell remoting, but that’s not required as how this works Рwe get the results by giving a remote machine IP Address or Machine Name.


That’s it for now, Enjoy the Power Of Shell!


Categories: Powershell Tags:

My Notes from the first UG meet of SQLBangalore

November 25th, 2012 4 comments

Yesterday I had the opportunity to attend Bangalore’s first SQL UG Meet.¬† It was amazing, lots of learning, and I had the opportunity to meet our favorite leads and see some of the people I have never heard about.¬† Lynn Langit and Raj Chauduri are those I see for the first time. Raj is an amazing SQL expert, his talks were fully on the practical side of the technology. You can find the full agenda of the event in my earlier post here.

Two rock starts of the Bangalore IT community took their debut as speaker.  Both of them did a great job. Finally there were cool snaps taken by event photographer Sandip (just kidding) and all of them is posted in Group Page.


Below are my notes from the sessions:

1) Short Circuit in SQL Server

SELECT * WHERE 1 / 0 = 1 AND 1 = 2    => No Error

SELECT * WHERE 1 / 0 = 1 OR 1 = 2       => Throws error

What I understood is¬† in such queries for an AND to be True, both condition should be true, SQL evaluates one condition and if its false, it¬†doesn’t¬†go to evaluate second, so there will be no error and no output as the query returns no match. when 1=2 is false, it does not have to check 1/0 = 0.

Same time when you use OR, or the query to be true one of the condition needs to be true, so for that SQL has to evaluate both, and while doing that in above example it reaches division by zero here. when 1=2 is false, it still need to check 1/0=0 because of OR.

What I am not yet clear is how can is say in the above Queries 1=2 is evaluated first, is there any precedence pattern for such queries.

2) DISTINCT is not a function when used in a SELECT Statement. (DISTINCT is used to get unique rows.)
3) New Functions in SQL Server 2012

EOMONTH() – this function returns the last day of the month, and can also be used to get last day of any given month, it accepts a second parameter, by which you can move months ahead or backwards.

For Example:

EOMONTH(GETDATE()) – End of this month

EOMONTH(GETDATE(),1) – End of Next Month

EOMONTH(GETDATE(),-1) – End of Last Month

4) When to use GETDATE()

When system generates the Date and its stored in the system, use GETDATE(). And to avoid time zone issues, always use GETUTCDATE() which will avoid time zone issues.


I am a pure SQL User in most of my interactions with SQL, and I use SQL queries to retrieve data from tables for reporting or to make decisions. JOIN was something I wanted to learn as I knew it‚Äôs the way to collect related data from multiple tables. In Raj Chauduri’s session I have learned a major part of my Basics about JOINS.

To make a note to myself:

SELECT * FROM [Events] JOIN [Speakers] ON [Events].[SpeakerId] = [Speakers].[Id]

Note:- Best practice – Never use * in any SELECT statements.

What does a JOIN do in SQL, it first creates a Cartesian Product  of tables. What does it mean is each row from the second table is combined with each row of first table and with all fields. Then the Join Predicate is applied, meaning Рfrom the combined table only rows matching the JOIN Condition is retrieved.

 There are three types of JOINS in SQL:  INNER, OUTER, and FULL

6) There are objects which are not migrated when you migrate a Database from one SQL Instance to Another:
  1. Logins
  2. Jobs
  3. Linked Servers
  4. CLR
  5. DB Mail
  6. Etc..

Contained databases in SQL Server 2012 comes as rescue for this, once this feature is enabled these configuration and metadata settings are included within the database.

Logins leaving behind when migrating a database was one problem I did see at job with SQL Server 2005, now I know what is the solution at least with SQL Server 2012.

7) ConlumStore Index makes you increase the speed of query without reducing the weight of the query.


I have posted in SQLBangalore to get answer to what I forgot, the products of the code names Ex-Velocity and Hackathone  РI will update here once I get an answer. Before I publish this post itself, I got the response:

Link Reference


A question asked by Vinod in his T-SQL Session:

Can you create a view when there is no table?

I guess yes, we can. As I understand a View is just like a definition or query, so you can create it when there is no table, but while retrieving the data from the View the Table should be existing.

I will update this once I get the correct answer.

The event was full of SQL and not to mention Pinal’s session was as usual full of laughter, but all those were well related to the subject he started from the 46th slide.


Below are a part of my collection of tweets from #SQLBangUG:


We will have such great meetings in future as well.

Happy Weekend!


Categories: Community Tags: