Welcome to MSDN Blogs Sign in | Join | Help

Larry's Project Dev Blog

The musings of developing for Microsoft Project.
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.

 

 

Posted: Thursday, December 11, 2008 10:38 AM by lduff

Comments

Marc said:

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

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

# June 26, 2009 5:49 PM

Francis said:

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.

# September 8, 2009 12:28 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker