In my last presentation at DeVry University, I show a solution build in PowerShell. There’s many components that are build in this small PowerShell script, such as:
1. Loading GAC’s – to have access to an specific .NET assemblies
2. ADO.NET components – use to connect to the SQL Server
3. Use of normal CMDLETS
4. Use of some global PS variables (example: “$Env:UserProfile”)
Well, here’s the code:
1. CshCBOrig.cs – this is code generated using Visual Studio were I created a basic Windows Form with two empty combo boxes and a button. Combo-box have no connectivity to any SQL table.
2. PSCBconvert.ps1 – This is the converted C# code to PowerShell .
3. PSCBconvert_wSQL.ps1 – This code include ADO.NET components use to extract information from the SQL Server. Also, this piece will generate the CSV file.
4. “OneLiner_Codebid_PS_Windows_Solution.txt” – Use this series of code bids and run it at the PS prompt.
5. I also include two PDF files were I documented my conversion steps from C# to PowerShell.
6. “Develper.bak” - copy of the SQL 2k database “Developer” w/test data.
Note: please make sure to change the variable that store the computer name with the sample to work.
Also, included the Microsoft SysInternal “ZoomIt” tool.
Thanks for your attendance,
Max Trinidad