header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Subject: openft problem with powershell
Prev Next
You are not authorized to post a reply.

Author Messages
noONEUser is Offline
New Member
New Member
Posts:2

06/06/2008 1:35 AM  

Hello,

I have a problem with a PowerShell-Seript which execute a openft command.

 

#START

$date = get-date -uformat "%Y%m%d%H%M%S"

switch($argsΎ]){
    test{}
    test2{}
    default{
        $source = "test" #localer Pfad der Dateien
        $name = "*.txt" #Name der Dateien (* für Widecard)
        $server = "hostip" #Serveradresse
        $dest = "/tmp" #Pfad auf Server
        $event = "" #Ereignis auf Server nach erfolgreicher Übertragung
   
        # Mailit Daten
        $from = "blub@bla.de"
        $to =
"blub@bla.de"
        $subject = "Fehler bei der Übertragung bei Datei"

    }

}

 
foreach ($file in get-Childitem $source\$name -name -exclude save){
    mv $source\$file $source\$file.$date
 
    C:\Programme\openFT\bin\ft "-m=f "$source"\"$file"."$Date" "$server"!"$dest"/"$file" user,,'password' -lf='mailit smtp  "$from" "$to" "$subject"' -ls=' mv "$source"\"$file"."$date" "$source"\save\"$file"' -rs='"$event"'"


}

#END

 

If I enter the openft command without variables directly in the shell, the command will be execued without any problems. If I start the PowerShell-Script... nothing. I get no error or something else.

 

halr9000User is Offline
CLI Addict
CLI Addict
Posts:245


06/06/2008 7:29 AM  
Try grabbing echoarges which is included with PSCX. It will help you see what's being passed after the tokenizing is done.

Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast (http://powerscripting.net)
Author, TechProsaic (http://halr9000.com)
noONEUser is Offline
New Member
New Member
Posts:2

06/11/2008 12:44 AM  
Hello halr9000,

thanks for this tip! I found the failure with echoargs.

$a = $source +'O.'+$file +'.send'
$b = $server+'!/tmp/'+$file
$c = 'user,,password'
$lf = ('-lf=mailit smtp blub@bla.de blub@bla.de \"openft: Fehler bei Dateiübertragung '+$a +'\" ')
$ls = ('-ls=cmd /c move ' +$source +'O.'+$file +'.send ' +$source +'save\' +$file)

C:\Programme\openFT\bin\ft $a $b $c $ls $lf $rs

Now the command works without any problems.
You are not authorized to post a reply.
Forums > Using PowerShell > Non-Microsoft Products > openft problem with powershell



ActiveForums 3.7
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer