Monday, 14 January 2013

Windows PowerShell - Get new GUID

Recently I took a brief tour of PowerShell, it’s the Microsoft’s task automation framework. It would suit you more if you consider your keyboard as your friend :). At the moment, I do not know whether I think it is useful or not. I think the more I get to know the various commands, the more I will use and appreciate it.

I am writing this post, so that I can record the PowerShell commands that I begin to use. Here’s is the first one:

Get a new GUID: Currently I use Visual Studio 2005 to get a new GUID value. Now opening up VS just to do that is really an overkill.
In PowerShell we can get it by:

[guid] is a type adapter (you can say alias) to the full class name – System.Guid. NewGuid() is a static method on that class.

If we don’t remember the adapter but if we do know the full class name, we can use –> $guid = [System.Guid]::NewGuid()

No comments:

Post a Comment

Note: only a member of this blog may post a comment.