header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
openft problem with powershell
Last Post 11 Jun 2008 12: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
Avatar

--
06 Jun 2008 01: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
    PowerShell MVP, Site Admin
    Advanced Member
    Advanced Member
    Posts:565
    Avatar

    --
    06 Jun 2008 07: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
    Author, TechProsaic
    noONEUser is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    11 Jun 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.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer