Lions, and Tigers, and Guids… oh my!


Everything in Project Server and SharePoint have Guids associated with them.  A friend asked about generating new unique Guids for repeatable deployments.  So of course I started writing a little console application to use System.Guid to generate the new Guid (I’m a developer, I always think in code).  But as I started thinking about emailing an exe, an idea struck me… PowerShell.  I had installed PowerShell months ago because I was told about using it to maintain my 20,000+ (and always growing) photo collection.  But have never got around to using it.  I fired up the console and the User Guide.  I looked through the TOC and found “Working with Objects.”  Within 10 minutes I had figured out the syntax.  So, cut to the chase… 


[System.Guid]::NewGuid().ToString()


 


I have one word for this… SWEET!  I look forward to playing with PowerShell more in the future.


 


 


Comments (2)

  1. Marc says:

    You can take it one step further with the pipe (|):

    System.Guid]::NewGuid().ToString().ToUpper() | Write-Clipboard -NoNewLine

  2. Francis says:

    Speaking of Guids, I have been wondering what was the use of the siteId Guid in project web access.

    I have been following this guide http://msdn.microsoft.com/en-us/library/aa974413.aspx to create a simple impersonation application.

    I have tried find a way to programmaticly retreive the siteID but failed. While doing tests, I realized that whether the siteId is valid or not does not seem to affect my application.

Skip to main content