YES!! Â It’s another great accomplishment from the Microsoft PowerShell Team. Â Just released on December 2nd 2011 this CTP (Community Technology Preview) come with fixes and more enhancements. Â Please CHECK out PowerShell ISE, is really showing some progress.
First thing!!!  READ:> IMPORTANT!! YOU NEED TO UNINSTALL WMF 3.0 CTP1!  Or, suffer the consequences.
But, it you’re one of the few experiencing Windows 8 Preview and using Hyper-V 3.0 then you can create another VM for a clean CTP2 installation experience. Â Or, just use the VM shapshot to to back and forth between version. Â So, take a pick.
This version comes with some documentation, so make sure to ready it. Â Also, don’t be afraid to submit bug reports at: https://connect.microsoft.com/PowerShell/. (you need to have a Live ID)
When running scripts, I notice there has been changes to how the “Set-ExecutionPolicy” behaves. Â I’m used to set my execution policy to “RemoteSigned“, but for this version now I had to changed it to “Unrestricted”. (more test to be done)
Also, don’t forget to execute the “Update-Help” as soon as you open PowerShell. Â This is working for most part.
Well, Here’s some tips to those who are first timers with Windows 8 Server (or Client) Preview edition. I have to say, after been using the previous version of Hyper-V, I’m very happy for what i’ve seen so far in Windows 8 Server with Hyper-V 3.0. As I finally completed updating/rebuilding all my VM’s for upcoming PowerShell and SQL Servers presentations, I have compiled 8 tips that might help the newbies get started using Microsoft Virtualization Technology.
Tip #1 – Memory is important
Yes, I totally agree with this one. After I upgraded my memory from 4GB to 8GB, all my VM’s are working OK. I have experience giving 1.5GB to a Virtual SQL machine is ideal for development.
Tip #2 – Enabling Hyper-V
First, There’s some differences between Hyper-V 3.0 server and Client. But, let me be clear, that every machine might be different. In my case, I have a 4 year old HP Pavilion dv7-* Entertainment laptop with Virutalization option enabled. I created a dual boot Windows 8 Server and Client version.
On the Windows 8 Server enabling “Hyper-V” role using the new “Server Manager” Dashboard was easy. But, in my case, I had to manually enable “Hyper-V Core” on my Windows 8 client by turning it “ON” in Windows Features. Here’s the command:
Tip #3 – Create your Hyper-V 3.0 Virtual Network Switch
This is very Important and one this you need to setup your Virtual Network connections in either Server or Client. Open “Hyper-V Manager” and look the “Virtual Switch Manager”.
As you can see in my picture, I have a Loopback adapter Virtual Switch (External), and a Wireless Virtual Swtich(Externa) both setup as Legacy Adapters).  These two combination works great when VM’s talk to each other and, at the same time, have access to the internet for Windows Update. Keep in mind, you can disable the wireless by going into the VM Settings option, going into the “Legacy Network Adapter”, and changing the “Virtual Switch” to “not Connected”.
Tip #4 – Don’t need a SAN Storage
FYI. Hyper-V 3.0 will allow you to create your VM’s practically anywhere. In my case, I have an External USB 1.o TB Storage drive. This is good new because you don’t need a SAN storage unit, and can save Vm’s outside your Physical server drives.
Tip #5 – Set VM’s TimeZone correctly
This might be only in my case, but after creating my VM’s and trying to connect them to join my Virtual Domain Controller, I experience connectivity issues between my VM’s due to their Time Zones not been the same. So, If you have a Virtual Domain Controller, make sure both Time Zone machines are the same.
Yes! This feature is a life saver. It can help you troubleshoot VM issues by you taking the snapshot of a VM machine before doing any irreversible updates that could force you start over to rebuild the machine over. It’s perfect when creating multiple scenarios for in test machines and adding descriptions to it. Also, you can also revert to a previous snapshot, or apply the changes.
Tip #7 – Bringing Legacy Microsoft VM to Hyper-V3
If you want to move all your existing VM’s from: Virtual PC, Windows Virtual PC, and Hyper-V, just remember to uninstall all “Virtual Components”, or “Integration Services” to prevent any misbehaviour in your VM. Then, you will be able to install the Hyper-V 3.0 “Integration Services” so that Hyper-V can manager your VM’s services such as: Snapshot, Start, Shutdown, or Save.
*hint*: I have experience some issues with Windows Servers 2008, and Windows 2003 SP1 after mvoing them to Hyper-V 3.0. The mouse won’t work even after installing “Integration Services”.
Tip #8 – Start using Use PowerShell
Yes! YES! This is your opportunity to start using PowerShell. You can user the Hyper-V module and start managing your VM’s. Also, don’t forget that PowerShell comes with over 1695 and about 63 Modules. Keep in mind, This numbers will varies depending on the enabled Windows features and/or installed Server Applications containing PowerShell modules.
Here’s some one-liners command you may want to try get the estimate numbers of PowerShell commands and modules:
1. Get total number of available  commands and list their names:
Here’s a simple PowerShell SMO code that shows you How-To change a SQL user password. Keep in mind, SMO needs to be installed and the assemblies loaded before using this code.
To load SMO, you can:
1. Install the SQLPS Module (is using SQL Server 2012 “Denali”), or Chad’s Miller SQLPS module for SQL Server 2008/R2.
Import-Module SQLPS -DisableNameChecking
2. Or, Load the SMO Assemblies using the PowerShell V2Â “AddType” command: (but carefull is you have multiple SQL Server versionsin the same box)
Add-Type -AssemblyName “Microsoft.SqlServer.Smo”
3. Or, use the still reliable the old PowerShell V1 load assemblies line using:
In the following example show how to connect to a SQL Server using both the default Windows Authentication (with high Administrator privileges already set), or SQL Server Authenbtication to later change a user password.
*Hint*:If you want to include special characters, you need to use the single qoutes or PowerShell will think that it’s a variable name.
As you can see, with just a few line of PowerShell SMO code you can start orchestrating a solution that can be applied to your SQL Server environments.
Here’s how I build my version of a standalone workgroup Windows 8 Server Virtual Machine(VM) with SQL Server 2012 (“Denal;i”) CTP3. When you create this VM, make sure to give enough memory.
How-To create a VM in Hyper-V Manager console:
I’m not going deep on this topic but the Hyper-V Manager GUI it’s easy to use. I’m assuming you already got an *.ISO image of both: Windows 8 Server Preview and SQL Server 2012 CTP3. If not you’ll have to find it at Microsoft website and/or your MSDN/Technet subscribtion.
Before Creating your new Virtual machine:
Keep in mind, you’ll need to setup you Hyper-V environment. Meaning, if you’re using a laptop and/or a desktop computer (not a server), still you need to make sure it meets the Hyper-V requirements or it won’t work.
So, at least you will need to use the “Virtual Switch Manager…” to assist you setting up your virtual network card to use by any VM you create.
Notice, in my environment, I have created three virtual network adapters:
Wired Internet
Wireless Internet
Loopback
The first two adapters serve my purpose to be able to connect to my physical machine Internet connection so I can do windows update. The loopback adapter is for my internal network connection to my virtual Domain Controller.
*Hint*: In order to allow your VMs to access your external wireless adapter, you need to enable in “Server Manager” the “Wireless LAN Service” feature before you create the virtual wireless adapter.
Now, you are ready to create a New Virtual machine, and just follow the wizard:
The “New Virtual Machine Wizard” will help you configured everything you need.   Make sure you create this VM with enough memory. In my case I assigned 1.5GB of memory.
Opening your Virtual Machine Connection:
There’s two ways to open your VM Connection in your “Hyper-V Manager” console:
By double-clicking at the actual virtual name.
Or, double-click at the actual virtual machine preview pane at the bottom left side of the “Hyper-V” console.
Now that your connection GUI is open, it’s a good time to start doing a VM Snapshot in case you need to go back and troubleshoot in case of problems. Here’s some pictures on How-To create a VM Snapshot:
If a Snapshot box asking to add a Name to your snapshot, go ahead and do it. This box only comes when there has been changes done to your VM.
Now, Ready for SQL Installation.
Installing SQL Server 2012 (“Denali”) CTP3:
After building the virtual server, if you try to immediately install SQL Server 2012, it won’t work. And, when you try to run the setup.exe, you won’t have access to the “SQL Server Installation Center” to view the “Hardware and Software Requirements” information.
In order to make my SQL Server installation work, I had to open Windows 8 “Server Manager” and follow the wizard to do the following steps:
Install the Application Server Role (you can add more roles as you need during this process).
Then, you need to add the following features: (again, you can add additional features as needed)
a. Enable the .NET Framework 3.5
b. Enable the PowerShell ISE
After doing this steps, then I was able to get the SQL Server setup to work and allow me to start my installation. Use the VM Connect GUI to allow you to attached the SQL Server  *.ISO image for your VM to start the SQL Server Installation.
I’m not going to show all the SQL Server installation screens but here’s to show that I’m able to proceed with the installation.
On the previuos picture, notice that I selected most of the features to install except the for the two Distributed Replay services. At the same time, I took a live snapshot of my VM before the actual installation process.
Installation Completed Successfully:
Yes! I got my SQL Server 2012 installed without a glitch!
Testing SQL PowerShell:
Now, I immediately testing the PowerShell SQLPS module. I was so excited that forgot to do something first. Here’s my result of my first try:
Yes! I forgot to set my “Set-ExecutionPolicy” to “RemoteSigned“, then close and reopen my Windows Console. I also I was able to SQLPS.exe from SSMS Database option just to test that there’s no errors. So, everything works at least for now.
Ooops! Except for PowerShell ISE. Yes! If you try to do an “Import-Module SQLPS -DisableNameChecking” then you get an error:
Don’t Worry! PowerShell ISE is not the only editor. You can still use Notepad to create/modify your script(s). Or, just try downloading one of the free community editors from: SAPIEN, and PowerGUI just to name a few.
To test SQLPS I use the following command line:
Invoke-SQLcmd -database ReportServer -Query “Select top 3 * from dbo.DBUpgradeHistory
Final comments:
I know I may have skip some steps but the bulk on How-To create Window 8 Server VM in shown in this blog. One important thing to keep in mind, these are still Community Technologies Preview (CTP) and it will change.
So, Don’t be afraid to try it! This is why we have the ability to create Virtual Machines in our own developement machines. Again, take advantage of Hyper-V.
The opportunity we have is to learn from them, assist giving feedback, and MOST IMPORTANT, it help us to stay ahead in upcoming technologies.
I’m excited to bring this new topic to #SQLSat86 Tampa for the BI community. So, here’s a brief rundown of what I will be covering on Saturday, November 5th morning session:
Topic: SSIS – Analyzing your data integrating PowerShell
*Note: This is not an all PowerShell Session but it plays a big role in this SSIS solution.
What will be covering:
1. Some basic to intermediate SSIS and PowerShell.
2. How to pass arguments between PowerShell and SSIS steps.
3. How to use PowerShell to assist in analyzing our tables and/or Data.
4. How to Integrate PowerShell in our SSIS Solution (when needed).
5. Tool available to allow these two technologies to integrate in our ETL solution.
This is going to be an ALL DEMO session.
Requirements:
1. Have some interest in PowerShell. 2. Some basic SSIS ETL experience. 3. Willing to be open to new technologies. 4. Most Important: No PowerShell experience is not required.
I will Demo:
1. Passing Arguments between PowerShell Applications in SSIS.
2. Work with both Script Task and Script Components.
3. Use of both VB and C# (CSharp) .NET Scripting code.
4. Some PowerShell.
Today, while help @meltondba with his SQLPS question on the enumerating jobs history, @LaerteSQLDBA provided a oneliner to provide this result. There’s one concern, should we use SQLPS instead of SMO.  For this answer I’m going to point out MSDN article regrading the future of SQLPS in upcoming SQL Server releases: http://msdn.microsoft.com/en-us/library/cc280450(v=SQL.110).aspx
This article states that “… This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use the sqlps PowerShell module instead. For more information about the sqlps module, see Import the SQLPS Module. …”
So, during this exercise I found out that I can out with the same number of line for either SQLPS and SMO. Both giving me the same results.
Here’s some picture ilustrating basic code snippet of both SQLPS and SMO to get some SQL Server Jobs information:
This pictures shows, it look simple enough. So, if you’re building SQLPS scripts, you can easily start transitioning your code to SMO.
Tonight I was able to download both Windows 8 Server with Hyper-V and the Windows Developer Preview ISO. I will create VM using the Developer Preview ISO, and then take a look at PowerShell V3 new cmdlets. As, everyone got an early start downloading the Windows Developer Preview edition, I will be working on the server version.
As you already know by now, PowerShell V3 is here with lots of new command to help manage your computer system. But, don’t take my word for it, if you’re at the BUILD Conference, don’t forget to attend Jeffrey Snover PowerShell Sessions: http://www.buildwindows.com/Sessions?q=PowerShell&x=0&y=0
The installation started with executing the downloaded *exe: en_windows_server_developer_preview_with_hyper-v_virtual_machine_x64_735222.exe
This executable will extract a VHD file:
Now, this VHD is good if you a media were you can boot from a thump-drive, or use the Windows 7 Boot from VHD feature.
Now, you’re better off downloading the ISO and burned it into a DVD. So, look for the “Windows Server Developer Preview (x64) – DVD (English)” in your MSDN Subscription.
So, I prepare a recovery DVD using the “Create a system repair disc” found in the “Backup and Restore” section. It works like a charm!
Back to Windows Virtual Machnes
By the way, I did try to create Windows 8 VM’s in both Windows 2008 R2 Hyper-V and Windows 7 “Windows Virtual PC” but didn’t work.
Now, I’ve heard that it’s possible to create a Windows 8 VM using VirtualBox. Try it!
On my laptop, I decided to install “Windows 8 Server w/Hyper-V” over my “Windows Server 2008 R2 SP1”. This way I can start setting up my new VM’s and see how the my older ones work under this new OS. This installation took about a couple of hours with a series of reboots.
Before, creating my VM’s, I needed to install the Hyper-V role and enable PowerShell ISE using the new Server Manager dashboard:
When you click on the Windows Flag to look for your application, it will take you to the new Start menu:
You will notice that “PowerShell” is available next to”Server Manager“. We click on Powershell and enter the $PSVersionTable to check version:
As you can see, this is PowerShell Version 3. This version comes with a total of 56 available Modules, 521 Cmdlets (excluding Modules command), 637 functions, and 146 Aliases. You got plenty of learning opportunities with this new version.
Now, As you all know, under the server features you need to “enable” PowerShell ISE. I try to use the Classic “Control Panel” but it didn’t work for me. So, you need to use the Server Manager, and click on the Manager Menu to get to “Add Feature” option:
After you have selected both Role(s),and Feaures then you’re ready to install them:
When the installation is completed, you will find PowerShell ISE ready to use from the new START menu:
After having installed Hyper-V, I was able to create both 64bit version of Window 8 Server and Desktop.
Now, how do you Shutdown your Windows 8 Server? Just do a Ctrl-Alt-Del and then at the “Shutdown” button found at the bottom right of the screen.
Let’s the fun begin!!
Big Hint!! Just found this tweet about booting from VHD: “New Blog: How to Boot from VHD with Windows 8 Developer Preview: http://t.co/JIBBQze3“
Additional Note: The client version of Windows Developer Preview, altought PowerShell V3 is included, it doesn’t show in your Start Menu.
Although, PowerShell give the whole remoting experience, you may still need to ask you network administrator to let you configure remoting on all the machines you need to access. Of course, unless you hold the keys of the kingdom. But, it is much  simpler without PowerShell Remoting.
When you use the SQLPS Module it automatically let you connect to any of your SQL Servers on your network. So, YES!! As long as you have permission to manage these servers, SQLPS already gives you the ability to remotely connect to other machines. There’s no need to setup the Remoting with Enable-PSRemoting or Set-WSManQuickConfig commands.
Simple Remoting #1
So, How can I change from my SQL Server local prompt to another instance? Here’s an example how:
[sourcecode language=”powershell”]
cd SQLServer:\SQL\Your-Machine-name\Default #or
cd SQLServer:\SQL\Your-Machine-name\Your-InstanceName
[/sourcecode]
4. Now you can continue and navigate through your SQL Server drive like in DOS filesystem.
[sourcecode language=”powershell”]
Dir Databases -force
[/sourcecode]
5. Finally, to remote connect top another session just change the “Your-Machine-name”, and your “Your-InstanceName”.
Simple Remoting #2
One thing you need to understand, after you load SQLPS module, now you have access to all SMO (SQLServer Management objects) .NET Classes. This will help you build short and very effective .NET that extend the scripting of PowerShell. Also, you don’t need to be at the SQLServer: drive to use it.
$SaveResult = Invoke-Sqlcmd -Query "SELECT * FROM [AdventureWorks].[dbo].[AWBuildVersion];" -ServerInstance "Your-Machine-name\InstanceName"
$SaveResult
[/sourcecode]
Again, there’s no need to be at the SQLServer: drive in order for this to work. As you can see, with just a few lines of code you can connect to another SQL Server instance.
As I started to build executable solutions in PowerShell for my SSIS packages, now I need to take advantage of providing an Exit Code value within the application. Creating your own exit code can be very useful for providing a Success or Failure of a task. This is way you can take the correct action on how your flow is going to behave.
1. Exit N – as shown on MOW’s blog (link above), only work in PowerShell
2. Exit (“N”) – I just try it but only work with PowerShell.
3. [Environment]::Exit(“N”) – Following the MSDN article (link above), it work in both PowerShell and DOS.
Here’s where “N” equals the Exit Number you want to provide. Also, you need to understand that this only work when executing your script with the PowerShell.exe at any command prompt: DOS or PowerShell.
Now, as you notice and probably wondering, I found out that “Exit N” and Exit(“N”) behave differently when is executed in both as a script, and compiled under PrimalForms 2011. I will show this in my examples.
In PowerShell V2, I found some different behaviour when using the above methods. My goal in these exercise is to provide an Exit Code that can be use in either PowerShell (as a Script and as Executable) and DOS (as executable). The reason is that you want to eventually convert your script as an executable in the future.
Here’s the basic structure on how this is done taking an example of a Division process where we’ll be trapping the “Divided by 0″ exception using “Try-Catch“. Then, after testing our script we can create the executable that can be included in an SSIS solution.
To validate the Exit Code has a value, we need to create en executable using PrimalForms 2011, then use the $LastExitCode in PowerShell and the %ErrorLevel% in DOS to confirm we have the values we want. Both Exit Code values need to match in PowerShell and DOS. These samples scripts will run under PowerShell console, and the compiled *.exe version will run under DOS.
Sample Script 3 – DivideNow3.ps1 – using “Exit N”.
This is the results we want to get. Both DOS and PowerShell will show the correct assigned Exit Codes. This script and executable will work and can be integrated in an SSIS package.
Bonus Script – Executing a PS Script from PowerShell.exe in the PowerShell Console to execute DivideNow.ps1
[sourcecode language=”powershell”]
#========================================================================
# Created with: SAPIEN Technologies, Inc., PrimalForms 2011 v2.0.12
# Created on: 9/2/2011 9:21 AM
# Created by: Max Trinidad
# Organization: PutItTogether
# Filename: DivideNow_test.ps1
#========================================================================
# .\DivideNow.ps1 40 5 – This will execute and close PowerShell immediately
# .\DivideNow.ps1 40 0 – This will execute and close PowerShell immediately
# But if I execute with PowerShell.exe
PowerShell -noexit -command { `
cd ‘C:\Users\Max\Documents\SAPIEN\PrimalForms 2011\Files’; `
& ./DivideNow.ps1 40 5}
Here’s where the fun begins. It took me a few hours to figure something out in order to my SSIS package pass some values into my PowerShell executable. So, here’s a sample solution where I found out that my Flat file source record didn’t match the record layout provide by another Internet source. Yes, believe or not, sometimes documentation out there might be way out of day. But, Thanks to SSIS “..Source Error Output“, you can redirect these records error to a destination object. Then you can later analysis these bad records.
So, if you work creating SSIS packages, then everyone should know how to use the “Data Flow component” to help you define your data Source, and Destination objects. Now, in cases when you need to isolate records that are causing your package to fail, then you need to add a second Destination object to deal with them later. In my example, my second Destination object will be to a new SQL table called “CompanyData_SkippedRecords“.
Here’smy sample Text file to be process by my SSIS package: “CompanyData.txt”
Notice, the first line are the columns, but some of the data in this file won’t match the column layout.  If I run this solution with the Source and Destination objects defined, this package will fail.
Now, we can add your another Destination component to isolate these unmatching records. Connect the Source component by dragging the “Red Arrow” to the second Destination Component handling the errors.
A “Configure Error Output” windows will popup, change the “Set this value to selected cells:” to  “Redirect row“. Then, highlight all fields in both “Error” and “Truncation” columns, and Click “Apply” to change the “Fail Component” to “Redirect row“.
Click “OK” when you confirmed that all fields has “Redirect row“.
These changes are in place for our Flat File Source “Error Output” section.
Now, we need to complete setting up out second destination component labeled “Error Skipped Records Destination” where our Error Records will be dropped into our new SQL table.
Open our Error Destination component. For now, we are going to use the default, the new table will be named “[Error Skipped Records Destination]”. So, all bad records will be stored in this table.
Then, click “OK” to exit.
At this step we are done with our Import and Error/Mismatch records handling, and we are ready to run our solution. At the end of this step will have bad records table.
Here’s our good data:
And, this is Error Records table:
Now, the next step, I need to a table to consolidate all my mismatched records. I will be reading from my “[Error Skipped Records Destination]” and selecting the “[Flat File Source Error Output Column]” field as “DataSkipped” into a new table called “CompanyData_SkippedRecords“.
CREATE TABLE [dbo].[CompanyData_SkippedRecords](
[DataSkipped] [text] NOT NULL,
[ErrRecordsLength] [varchar](7) NOT NULL,
[TotalFieldsPerRecords] [varchar](5) NOT NULL,
[FileGroupSource] [varchar](4) NOT NULL,
[ProcessDate] [datetime] NOT NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
[/sourcecode]
As you may notice, this table is very different than the we one createdto store the errors. And here’s where we integrate our PowerShell script solution into our SSIS Package.
PowerShell Script
In this new table out of the 5 fields 4 will be genrated by PowerShell , and two of them are coming from parameters:
DataSkipped – comes from the our Err table.
ErrRecordsLength – Count of the length of each records skipped.
TotalFieldsPerRecords – Count the number of fields per records (using the delimiter -1).
FileGroupSource – Denominates the type of records that was imported (ie.Comp).
ProcessDate – Date that this Err table was process.
The purpose of this PowerShell executable it to generate this additional fields to help analyzing what’s wrong with my Text file. This process will read one Err Record at a time, generate the addition values, and insert into the new table.
One requirement:You need to have the SQLPS module installed in your “MyDocument\WindowsPowerShell\Modules” folder were the user is running this SSIS package, or will not run. If you’re usign SQL Server 2008 R2, then download the SQLPS module from Chad’s Miller blogsite:http://sev17.com/2010/07/making-a-sqlps-module/(SQL Denali CTP3 already has it). max
Here’s the Script (don’t be scare!), to be compiled with PrimalForms 2011:
[sourcecode language=”powershell”]
# =============================================================
# Microsoft PowerShell Source File — Created with SAPIEN Technologies PrimalScript 2011
# NAME: AnalyzeSkippedRecords.ps1
# AUTHOR: Max.Trinidad ,
# DATE : 8/18/2011
#
# COMMENT: PowerShell Script to Analyze the Data Skipped for processing and update the Skipped
# table with additional information.
# =============================================================
PARAM([String] $Arg1, [String] $Arg2, [String] $Arg3)
#Imput: $Arg1="Err*"; $Arg2 = "Developer"; $Arg3 = "YourComputer"
Notice this script was meant to search for multiple error tables based of the type of File groups (ie. ADB1, ADB2, and ADB*). Now, using the steps from Passing Parameter to a PowerShell executable – Part – 1 on the previous blog, i compiled my script and create my executable. Keep in mind, the you will need to move this executable to the machine you are running this SSIS Package. Thanks to SAPIEN for this Great product!
Create SSIS Variables for input Parameters for the PowerShell Executable
This part took me a few hour to figure out how to pass parameters using the SSIS variables in combination with “Expressions”. Yes!! That was the keyword “Expressions”. I couldn’t fine a blog out there that will properly explain this process. Just one that I will give some credit because this keyword got my attention: http://dennyglee.com/2006/05/12/ssis-global-variables-and-execute-process-task/ – “..you can modify the Execute Process Task at the point of the Property Expression attribute..”. Unfortunately, thsi blog didn’t show a step-by-step on how this done. But, lucky you, I’m blogging about it.
Here’s how is done:
Create three variable that will hold some parameters values to be injected into the executable:
Now, we add the “Execute Process Task” component, connect the “Data Flow Task”, and double-click on the “Execute Process Task”. In the “Execute Process Task Editor”, go to the “Process” section and in “Executable” add the executable name “AnalyzeSkippedRecords.exe”.
And now,… to setup your input parameters, Go to the “Expressions” section:
Here’s where you define the input Argument(s) for your executable(s). Under “Property expressions”, you select the property “Argument”, and then click on the “…” to build the expresions:
Yes!! This is the money maker:Â ( there’s a space between the double-quotes )
Now, click “OK” twice to save the changes, and we ready to run our full SSIS package.
Success!! This solution works.
Check my “CompanyData_SkippedRecords” table:
Now, I can keep working on analyzing this data with PowerShell, and/or other tools.
Couple of Pointers:
In the “Execute Process Task Editor”, you can troubleshoot your executable session if you leave the setting “WindowStyle” to Normal. This way you can see the console popup. Then, when everything is working correctly, change it back to Hidden“.
Also, if you’re having some problem with the PowerShell executable failing, you can add the “Write-Host ‘Pause’; Start-Sleep -second 10;” oneliner command to pause the session and give you time to see the error when leaving the “WindowsStyle” as Normal.