Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

How to pass a variable from ssis 2008 process task to a powershell v1.0 scripts

$
0
0

Hello All,

I am very new to powershell as a etl developer.  I am trying to pass a file name stored as a variable in the ssis package to a "Process task" transformation.  The process task is to execute a powershell script  using that passed variable to  select a file for download.

If the variable is in the script hard-coded it works fine.  It is the passing of the variable to the process task that is failing.

Powershell version is 1.0.

I have the PARAM string at the top of the script. Here is the script:

CLEAR

PARAM(

    [string]$SelectedName

    )

$shell_app=new-object -com shell.application

if(!$?){

   echo "Error Creating Shell Application"

   exit 99

}

$clnt = new-object System.Net.WebClient

if(!$?){

   echo "Error Creating WebClient"

   exit 99

}

 

 

## inside varible works fine

##set-variable -name newfilename -value "3557775904152dat.txt"

##$file =  get-variable  -value newfilename

 

# Passing the variable to the script is failing

 

set-variable -name newfilename -value $SelectedName

$file =  get-variable  -value newfilename

 

$url = "x:\SQL\DATA\NDW\Weather\Historical\Archive\" + "$file"

 

$file_mypath = "x:\SQL\DATA\NDW\Weather\Historical\Processing" + "\$file"

 

if(!$?){

   echo "Error Obtaining File Location"

   exit 99

}

$clnt.DownloadFile($url, $file_mypath)

 

##Write-Host ‘Pause'; Start-Sleep -second 20;

## end of script

Can anyone show me a screeenshot of what the process task is suppose to look like to pass a variable into the script?

I have already spent three weeks on a 1 minute solution i'm sure.

Thanks for any help you can give me.

mike777

 

 

 

 

 


Viewing all articles
Browse latest Browse all 8411

Trending Articles