Friday, March 28, 2014

Powershell, queries with ecryption, oh my!

So a colleague asked me for some help with a manual task he was performing daily; extract the results of an SQL query to a CSV file and drop it on a file share of another system for billing purposes.

Let me set the stage for you first. Our network is segregated so putting the extracted results on a file share for the billing system is not going to be easy.


  1. SQL Server 2008 R2 is our RDBMS
  2. Windows 2008 R2 64bit is the OS
  3. Powershell is my tool of choice with a splash of .Net (in this case 3.5)
  4. SQL Server Management Studio (cuz I need the snap-in goodness)


Of course I needed some help to the interweb and articles on the following:
  1. Encrypting SQL passwords using PS; http://bit.ly/1dBFoYY
  2. Learning a little about Invoke-Sqlcmd; http://bit.ly/1g8pVtQ
  3. More PS and Invoke-Sqlcmd; http://bit.ly/1pC29vT
Now I was ready all my tools and requirements in place to put this thing together, to solve the problem regarding the share I was going to employ email as my vehicle for delivery.

My 'solution' uses three (3) scripts; the main script to execute the query to a file which utilizes a second script file as a library to decrypt my username and password. The final script is the one I do not put on the server but use to generate my password file but also uses the second script file as a library to encrypt the values.

** Something I learned is that if you are using passwords with special characters the cryptography algorithm truncates the passed in value!! You need to therefore use an escape character in your password to prevent this from happening.

Above I mentioned the snap-in goodness where here is where it comes in handy, the snap-in allows me to run my query in a single line being as efficient as I can with my code focusing on the things that matter; the query and delivery of results.



In the main script adding a little logging (stringbuilder) and error handling for good measure and I was done. I hope you found this helpful, I enjoyed putting this together and really enjoy using Powershell.

Monday, February 17, 2014

My Raspbmc project

So in the latter part of 2013 I embarked on my very first Raspberry Pi project to build a media device able to accept Polish content streams off of the Internet.

I started with zero knowledge but a whole lot of ambition to learn and see what this small box could do.

Went to ebay to order my Raspberry Pi and clear case, bought an over sized SD card at a local store, picked up a 3 foot HDMI cable at the dollar store, purchased a Logitech wireless keyboard  and reused a micro-usb cable for my power source. Since my house is wired with CAT-5 I did not need to get a wireless dongle which would also make the streaming that much better over a wired connection.

Installing the Raspbmx image is easy with the Windows installer; http://www.raspbmc.com/wiki/user/windows-installation/

Next I installed Navi-X; it's a media streaming addon for XBMC - VERY NICE, get it here https://code.google.com/p/navi-x/


After following the guide from the link above you will have a working system with the most basic functions. Some content either on the internet or off of your home network may require you to go out and get additional codecs; MPEG2 and VC-1.

Here is a resource where I found a lot of good information on how to purchase and insert the keys once I received the email. Read it carefully, I caused myself unnecessary delay because I misread one part. http://www.howtogeek.com/137654/how-to-add-mpeg-2-and-vc-1-video-codec-support-to-your-raspberry-pi/

Happy Streaming!


Wednesday, July 6, 2011

Citrix 256 Color Display Issue with dual monitors

If you are having a problem connecting to your Citrix presentation server and drop down to 256 colors you might have this issue. Here is a chart from Citrix support describing the proper resolution to set your monitors to in order to get 16 bit colors orhigher.

http://support.citrix.com/article/CTX781561

Tuesday, July 5, 2011

Application Launch Fails after Upgrading to Internet Explorer 9

The following link discusses the fix for using Citrix Web Plugin and IE9. The symptoms basically do not allow you to launch the downloaded ICA files and the browser interprets the URL for the Citrix resource as an ActiveX component and tries to install it.

Monday, April 11, 2011

OData Service for TFS 2010

From: Bryan Group [MSFT]
Posted At: Monday, April 11, 2011 9:38 AM
Posted To: MSDN Canada
Conversation: CDN MSDN Blogs
Subject: OData Service for TFS 2010
 

OData Service for TFS 2010

A lot of developers who I speak to have come up with some very creative ways to interact with Team Foundation Server (TFS) and while some of these methods aren’t fully supported it just goes to show that if there’s a need then there’s a way. To that end, Brian Keller has a fantastic blog post and video of a new beta for TFS 2010 using OData. As he points out, using this new service will give developers the ability to expose this data to any application stack which supports HTTP requests as well as providing access to TFS related data to users on multiple devices.



Provide feedback on the beta:
TFSOData@Microsoft.com.

Read more


 

 



The information transmitted is intended only for the addressee and may contain confidential, proprietary and/or privileged material. Any unauthorized review, distribution or other use of or the taking of any action in reliance upon this information is prohibited. If you receive this in error, please contact the sender and delete or destroy this message and any copies.