<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Powershell Script Task for SSIS</title>
	<atom:link href="http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/feed" rel="self" type="application/rss+xml" />
	<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488</link>
	<description>making DBAs everywhere curse!</description>
	<lastBuildDate>Sat, 04 Feb 2012 06:02:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Steph Sullivan</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-238</link>
		<dc:creator>Steph Sullivan</dc:creator>
		<pubDate>Tue, 26 Oct 2010 08:38:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-238</guid>
		<description>I checked without spaces but it still didn&#039;t work.  Thanks for looking at this for me.  

#variable writing
$fileRef=$ssis.Variables[&quot;User::PSLiveServer&quot;]
$fileDif=$ssis.Variables[&quot;User::PSDevServer&quot;]
$dest=$ssis.Variables[&quot;User::FolderRoot&quot;]
$compFolder=$ssis.Variables[&quot;User::FolderNew&quot;]
$compFile=&quot;PHPScripts.csv&quot;
$fileArray=get-childitem $fileRef -include &quot;*.php&quot; -name
$fileClearOut=get-childitem $dest -include &quot;*.csv&quot; -name

#delete any existing csvs created in last execution
get-childitem $dest -include &quot;*.csv&quot; &#124;remove-item

#creates file results to be output to
if ((Test-Path -path $compFolder) -ne $True) 
    {
    new-item $compFolder -type folder -force
    }
if ((Test-Path -path ($compFolder + $compFile)) -ne $True) 
    {
    new-item ($compFolder + $compFile) -type file -force
    }

#identifies changes and creates a csv for each changed file
foreach ($element in $fileArray)
{
    #has to create a dummy file for files that don&#039;t exist in diff directory
    if ((Test-Path -path ($fileDif + $element)) -ne $True) 
    {
    new-item ($fileDif + $element) -type file -force
    }

$strRef = get-content -path ($fileRef + $element)
$strDif = get-content -path ($fileDif + $element)
$output = $dest + $element.replace(&quot;.php&quot;,&quot;.csv&quot;)

compare-object $strRef $strDif &#124; new-item $output -type file -force
}

#delete dummy files
get-childitem $fileDif -include &quot;*.php&quot;  &#124; ? {$_.LastWriteTime -gt (get-date).AddMinutes(-5)} &#124; del 

#gather script names
get-childitem $dest -include &quot;*.csv&quot; -name &#124; out-file -FilePath ($compFolder + $compFile) -force</description>
		<content:encoded><![CDATA[<p>I checked without spaces but it still didn&#8217;t work.  Thanks for looking at this for me.  </p>
<p>#variable writing<br />
$fileRef=$ssis.Variables["User::PSLiveServer"]<br />
$fileDif=$ssis.Variables["User::PSDevServer"]<br />
$dest=$ssis.Variables["User::FolderRoot"]<br />
$compFolder=$ssis.Variables["User::FolderNew"]<br />
$compFile=&#8221;PHPScripts.csv&#8221;<br />
$fileArray=get-childitem $fileRef -include &#8220;*.php&#8221; -name<br />
$fileClearOut=get-childitem $dest -include &#8220;*.csv&#8221; -name</p>
<p>#delete any existing csvs created in last execution<br />
get-childitem $dest -include &#8220;*.csv&#8221; |remove-item</p>
<p>#creates file results to be output to<br />
if ((Test-Path -path $compFolder) -ne $True)<br />
    {<br />
    new-item $compFolder -type folder -force<br />
    }<br />
if ((Test-Path -path ($compFolder + $compFile)) -ne $True)<br />
    {<br />
    new-item ($compFolder + $compFile) -type file -force<br />
    }</p>
<p>#identifies changes and creates a csv for each changed file<br />
foreach ($element in $fileArray)<br />
{<br />
    #has to create a dummy file for files that don&#8217;t exist in diff directory<br />
    if ((Test-Path -path ($fileDif + $element)) -ne $True)<br />
    {<br />
    new-item ($fileDif + $element) -type file -force<br />
    }</p>
<p>$strRef = get-content -path ($fileRef + $element)<br />
$strDif = get-content -path ($fileDif + $element)<br />
$output = $dest + $element.replace(&#8220;.php&#8221;,&#8221;.csv&#8221;)</p>
<p>compare-object $strRef $strDif | new-item $output -type file -force<br />
}</p>
<p>#delete dummy files<br />
get-childitem $fileDif -include &#8220;*.php&#8221;  | ? {$_.LastWriteTime -gt (get-date).AddMinutes(-5)} | del </p>
<p>#gather script names<br />
get-childitem $dest -include &#8220;*.csv&#8221; -name | out-file -FilePath ($compFolder + $compFile) -force</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhys</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-236</link>
		<dc:creator>Rhys</dc:creator>
		<pubDate>Mon, 25 Oct 2010 20:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-236</guid>
		<description>Hi Steph,

Mmmmm, all sounds ok. Perhaps try removing the spaces in your list?

I&#039;m not on a computer with BIDS but post your Powershell code and I&#039;ll have a look into it tomorrow night.

Cheers,

Rhys</description>
		<content:encoded><![CDATA[<p>Hi Steph,</p>
<p>Mmmmm, all sounds ok. Perhaps try removing the spaces in your list?</p>
<p>I&#8217;m not on a computer with BIDS but post your Powershell code and I&#8217;ll have a look into it tomorrow night.</p>
<p>Cheers,</p>
<p>Rhys</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steph Sullivan</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-235</link>
		<dc:creator>Steph Sullivan</dc:creator>
		<pubDate>Mon, 25 Oct 2010 16:30:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-235</guid>
		<description>I must be doing something wrong because I get this error message:
Error: Failed to lock variable &quot;FolderNew, FolderRoot, PSDevServer, PSLiveServer&quot; for read access with error 0xC0010001 &quot;The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.&quot;.

In the read-only section I&#039;m putting: &quot;PSLiveServer, PSDevServer, FolderRoot, FolderNew&quot; (without the speech marks)


It works on just one variable, but then of course it fails because I haven&#039;t passed in enough variables for the powershell task.</description>
		<content:encoded><![CDATA[<p>I must be doing something wrong because I get this error message:<br />
Error: Failed to lock variable &#8220;FolderNew, FolderRoot, PSDevServer, PSLiveServer&#8221; for read access with error 0xC0010001 &#8220;The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.&#8221;.</p>
<p>In the read-only section I&#8217;m putting: &#8220;PSLiveServer, PSDevServer, FolderRoot, FolderNew&#8221; (without the speech marks)</p>
<p>It works on just one variable, but then of course it fails because I haven&#8217;t passed in enough variables for the powershell task.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhys</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-234</link>
		<dc:creator>Rhys</dc:creator>
		<pubDate>Thu, 21 Oct 2010 20:19:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-234</guid>
		<description>Hi Steph,

I just compiled this I didn&#039;t write it.

To use multiple variables just enter them as a comma-separated list in the Read-only/write variables text boxes. ie. variable1,variable2,variable3...

You can then access then with the following Powershell code...

&lt;pre lang=&quot;Powershell&quot;&gt;
$var = $ssis.Variables[&quot;User::variable_name&quot;];
&lt;/pre&gt;

Hope that helps.

Cheers,

Rhys</description>
		<content:encoded><![CDATA[<p>Hi Steph,</p>
<p>I just compiled this I didn&#8217;t write it.</p>
<p>To use multiple variables just enter them as a comma-separated list in the Read-only/write variables text boxes. ie. variable1,variable2,variable3&#8230;</p>
<p>You can then access then with the following Powershell code&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p488code1'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4881"><td class="code" id="p488code1"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$var</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ssis</span>.Variables<span style="color: #000000;">&#91;</span><span style="color: #800000;">&quot;User::variable_name&quot;</span><span style="color: #000000;">&#93;</span>;</pre></td></tr></table></div>

<p>Hope that helps.</p>
<p>Cheers,</p>
<p>Rhys</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steph Sullivan</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-233</link>
		<dc:creator>Steph Sullivan</dc:creator>
		<pubDate>Thu, 21 Oct 2010 13:56:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-233</guid>
		<description>Hiya, 
Thanks for the excellent task available for free.

I&#039;m having difficulty inputting multiple variables into the task.  Could you explain the syntax please?

Thanks in advance,
Steph</description>
		<content:encoded><![CDATA[<p>Hiya,<br />
Thanks for the excellent task available for free.</p>
<p>I&#8217;m having difficulty inputting multiple variables into the task.  Could you explain the syntax please?</p>
<p>Thanks in advance,<br />
Steph</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhys</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-156</link>
		<dc:creator>Rhys</dc:creator>
		<pubDate>Wed, 14 Apr 2010 20:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-156</guid>
		<description>Hi Robin,

I&#039;ve not had the chance to run your code but try removing the &#039;cls&#039;. I think this may be causing your error.

I see your using the -recurse option so using the ForEach loop to get filenames isn&#039;t an option for you?

Rhys</description>
		<content:encoded><![CDATA[<p>Hi Robin,</p>
<p>I&#8217;ve not had the chance to run your code but try removing the &#8216;cls&#8217;. I think this may be causing your error.</p>
<p>I see your using the -recurse option so using the ForEach loop to get filenames isn&#8217;t an option for you?</p>
<p>Rhys</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Tanner</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-154</link>
		<dc:creator>Robin Tanner</dc:creator>
		<pubDate>Wed, 14 Apr 2010 14:55:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-154</guid>
		<description>Rhys,

In the below code, I&#039;m trying to pipe a list of filenames to an object variable.  

cls
# PowerShell script to list the txt files under the IDX folder
cd\
cd \\[FileServer]\[Directory]
$Dir = get-childitem \\[FileServer]\[Directory] -recurse
$List = $Dir &#124; where {$_.extension -eq &quot;.txt&quot;} 
$FileNames = $List &#124; ft name
$ssis.Variables[&quot;User::FileNames&quot;] = $FileNames;

However, when I do this, it tells me the following:

Exception setting &quot;CursorPosition&quot;: &quot;The method or operation is not implemented.&quot;

Any ideas..?</description>
		<content:encoded><![CDATA[<p>Rhys,</p>
<p>In the below code, I&#8217;m trying to pipe a list of filenames to an object variable.  </p>
<p>cls<br />
# PowerShell script to list the txt files under the IDX folder<br />
cd\<br />
cd \\[FileServer]\[Directory]<br />
$Dir = get-childitem \\[FileServer]\[Directory] -recurse<br />
$List = $Dir | where {$_.extension -eq &#8220;.txt&#8221;}<br />
$FileNames = $List | ft name<br />
$ssis.Variables["User::FileNames"] = $FileNames;</p>
<p>However, when I do this, it tells me the following:</p>
<p>Exception setting &#8220;CursorPosition&#8221;: &#8220;The method or operation is not implemented.&#8221;</p>
<p>Any ideas..?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Weekly Link Post 125 &#171; Rhonda Tipton&#8217;s WebLog</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-126</link>
		<dc:creator>Weekly Link Post 125 &#171; Rhonda Tipton&#8217;s WebLog</dc:creator>
		<pubDate>Mon, 28 Dec 2009 02:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-126</guid>
		<description>[...] Powershell Script Task for SSIS &#8211; Good post on a Powershell Script Task. [...]</description>
		<content:encoded><![CDATA[<p>[...] Powershell Script Task for SSIS &#8211; Good post on a Powershell Script Task. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhys</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-124</link>
		<dc:creator>Rhys</dc:creator>
		<pubDate>Sun, 27 Dec 2009 12:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-124</guid>
		<description>Hi Todd,

I didn&#039;t have the ability to attach files to a discussion on codeplex. So I&#039;ve uploaded it here...

http://www.youdidwhatwithtsql.com/wp-content/downloads/ssis_tasks/Defiant.SqlServer.PowerShellScriptTask.dll

Rhys</description>
		<content:encoded><![CDATA[<p>Hi Todd,</p>
<p>I didn&#8217;t have the ability to attach files to a discussion on codeplex. So I&#8217;ve uploaded it here&#8230;</p>
<p><a href="http://www.youdidwhatwithtsql.com/wp-content/downloads/ssis_tasks/Defiant.SqlServer.PowerShellScriptTask.dll" rel="nofollow">http://www.youdidwhatwithtsql.com/wp-content/downloads/ssis_tasks/Defiant.SqlServer.PowerShellScriptTask.dll</a></p>
<p>Rhys</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd McDermid</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488/comment-page-1#comment-123</link>
		<dc:creator>Todd McDermid</dc:creator>
		<pubDate>Sat, 26 Dec 2009 23:15:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-script-task-for-ssis/488#comment-123</guid>
		<description>Rhys,

If you&#039;ve compiled it for 2008, you should upload the DLL back to the CodePlex project as an attachment on a Discussion post or something.  Though there&#039;s no installer even if you do that, it takes it one step closer to making it easier for someone else to use it.

(I need to start learning Powershell!)</description>
		<content:encoded><![CDATA[<p>Rhys,</p>
<p>If you&#8217;ve compiled it for 2008, you should upload the DLL back to the CodePlex project as an attachment on a Discussion post or something.  Though there&#8217;s no installer even if you do that, it takes it one step closer to making it easier for someone else to use it.</p>
<p>(I need to start learning Powershell!)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

