Documenting Failure: Powershell with Windows Live Skydrive ? Anyone ?

I think I spent the whole day chasing weird ideas, testing out codes and none of them came to any fruition. I wanted to document my attempt at solving the problem, document my initial over exuberance and expectations, and may be irrationality in concluding it can’t be done – all within 10 hrs. I was looking for some structured format (maybe a form ?). I am going to probably attempt this from memory and update the post later with relevant links.

Googled How to Document Failure.
Binged. (Related Search result > How to document nursing Notes / How to document in nursing…Real classy.)
No luck.

There was a blog entry from Sybase about how important it is to document failure, but nothing else. There are PMI surveys of project failure, but I was looking for some type of a structure to document failure from the dev’s point of view. I spent a huge amount of time trying to R&D something with nothing tangible to show-off as achievement by the end of the day. I am super super-pissed on the amount of time I wasted on this.

Begin-State: How cool will it be if you can write a one-way log for all PoSH scripts and upload it on Skydrive ?

Why Skydrive ?

  1. 25 gigs free, more than enough for logs.
  2. Logging separate from the production system. In case your scripts blows up a building, there will be a log for that.
  3. There’s a good chance that there is an API for Windows Live. Might be a good idea to expand upon my Powershell+API’s approach and experiment with other REST API’s.

Why Powershell ? >> DUHHHH !!

Initial R&D (implicit but validated)

  1. Does Skydrive have an API ? Yes
  2. Is it documented. Are there code-samples. > Yes
  3. Are there sample-code from non-Microsoft sources – Github etc. > Yes
  4. Is there a Powershell version of it ? > Nope. But you do have C#, IOS, Windows Phone, Javascript.

Assumptions:

  1. API’s will have simple auth service / Tokenized. I should have thought of Windows Authentication and SSO’s before attempting this but I didnt.
  2. Didnt anticipate multiple layers.
  3. I thought you can take a .DLL and do an add-type and get cracking with it. [doug Finke source. Joel Bennett stuff from poshcode]
  4. There was no DLL for Windows Live, so I tried to plug-and-chug a Windows Live phone.DLL. Now that I am doing a post-mortem analysis, I am not sure why I thought of that in the first place.

Different Approaches or in other words: My Try/Catch blocks. {there was no catch.}

  1. Review the code. Skipped IOS/Android
    Checked PHP/ASP/ Windows Phone.
    can you do a
    Add-Type -Path “C:\Users\Administrator\Documents\WindowsPowerShell\Modules\Live\Microsoft.Live.Controls.dll”
    Add-Type -Path “C:\Users\Administrator\Documents\WindowsPowerShell\Modules\Live\Microsoft.Live.dll”
    Add-Type -Path “C:\Users\Administrator\Documents\WindowsPowerShell\Modules\Live\Microsoft.Live.Controls.Toolkit.dll”
    Answer > NOPE. Add-type erroring out
  2. Can you do that region based thing with DLL’s and a C-Sharp classes code and Namespace.
    Didn’t get it to work. I figure I didnt have the right DLL’s. I was trying to plug phone DLL’s on Windows 2008 R2
  3. Checked the REST API.
    Took some time trying to figure out Var’s/Tokens.
    they have a live SDK of Windows Live API. Neat
    I got the variables back when i ran the code.

big-problem
3a) you need a client-id. Looks like it is similar to an app-developer ID. I had no intention of going through the steps.
There was a big section on before you begin.

3b) Tried doing a System.nativeclient / Get-URL with these, but erroring out
GET https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=SCOPES&response_type=RESPONSE_TYPE&redirect_uri=REDIRECT_URL
https://apis.live.net/v5.0/me/contacts?pretty=false&access_token=ACCESS_TOKEN

Bad Client-ID (I was using the client-ID from live SDK.

3c) Checked Support Forums / Microsoft Connect.
Some of the answers in Forums point to cases on Microsoft Connect, which are not publicly accessible.
They have been marked as an Answer in forums but USELESS.

3d) I had the access token / folder ID numbers etc.
You can’t do any Get-URL’s without the clientID. Period.

OPTOIN-4:

I had already spent a good amount of 10 hrs on this since morning running on 5 hrs of sleep from last night. I was really drained by the time You can have the Windows Live drive mapped. I remember I had done this earlier and sufficient amount of documentation @ lifehacker level.
Maybe you can do a Get-PSDrive on the mapped drive and fulfill the original goal of writing logs to Skydrive.

But it wasn’t sexy enough. It was kinda boring and i didn’t want to rely on mapped drives to do this.
I’d rather do it with a TOKEN and get-cred, put it into a file and then call it.

Reason for Rejecting:

Mapped-drives break for weird reasons.
Mapped-drives over the Internet can break for too many reasons, I am not attempting a secure logwriter with this.
I arrived at this point and the triviality of the solution pissed me off {You should have thought of this earlier / Are you sure you can just do a mapped drive on this ?}. I convinced myseld that my script will fail for sure with this solution.

End-State:

  1. End of the day I was really frustrated with perceived limitations of the Windows Live API.
  2. The REST API looks like it gives preference to developers who will build Apps on Windows or Other Mobile Phones. It assumed a URL redirect path etc, which I am not sure I can achieve with Powershell.
  3. To get ammo for my frustration, I did some quick searches on ProgrammableWeb.
    Microsoft has 14 REST API’s for Bing Maps, Windows Live, Photos and crap. Might be a good idea for consumer products, but sucks in enterprise.
    Maybe Microsoft is going WSDL/SOAP way and started on the REST game late. Maybe they just don’t care.

Conclusion:

  1. I am documenting my approach to this, so that someone else doesn’t have to spend 10 hrs to arrive at SCREW CLIENTID.
  2. Please dont plug Phone DLL’s to 2008R2/Win7 or anything with a PC. I dont think they were meant to work in the first place.
  3. Maybe you can write your DLL, if this is that important to you.

On Second thoughts, Why would you write your own DLL, when you can play with the Dropbox REST API ?

My Moral of the story (Yours maybe different.)
$20 a month is peanuts for 10 hrs of wasted Dev Time.

PS: What not to do.

  1. Dave McClure’s post calls 500 hats a Fail Factory, but zero documentation of a single failure anywhere. Dude that’s disappointing for a fail-factory. That’s the least you could do if you call yourself a fail factory.
  2. Pointless example of a pitch here with HandshakeUmbrella.com. It was terrible to watch. I am not sure why anyone would use this as an exercise for anything other than learning when to stop talking.

Reminds me of the time when my wife was asked to attend this Indian Women’s Group in College. The lady over there split the group into 3-teams and asked them to discuss “Modern Indian Youth”.

Group-1 Had to discuss Modern.
Group-2 Had to discuss Indian.
Group-3 Had to discuss Youth.

I wasn’t there, she tells me it was torture in slow-motion to see people in a group go on and on for 15 mins to discuss the word Modern.I had a similar feeling after watching that video.

Bad Mouthing Tropo. Why ? What’s the point.

I love Tropo. Loved them for the 3 days I have known them. It does its job and gets out of the way.
They make it easy to love them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s