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

openft problem with powershell
Last Post 11 Jun 2008 08:44 AM by noONE. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
noONEUser is Offline
New Member
New Member
Posts:2

--
06 Jun 2008 09: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[0]){
    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
Basic Member
Basic Member
Posts:316

--
06 Jun 2008 03:29 PM  
Try grabbing echoarges which is included with PSCX. It will help you see what's being passed after the tokenizing is done.
noONEUser is Offline
New Member
New Member
Posts:2

--
11 Jun 2008 08: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.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer