Solved

Unexpected token 'default" -append  #-ErrorAction silentlycontinue

Posted on 2012-03-09
2
754 Views
Last Modified: 2012-08-13
Hello,

When I execute this script, this error is returned :
Unexpected token 'default" -append  #-ErrorAction silentlycontinue
  }
# Si pas de TCP Port
if ($tcpPort -eq `") {
 "Pas' in expression or statement.
At C:\Temp\test.ps1:103 char:6
+       <<<<  echo $buf | out-file $OUTPUT_FILE -ErrorVariable ERR1 -encoding "default" -append
continue

##############################################################################
# Main Program 
##############################################################################

$tcpPort=(getTcpPort $mach_name $inst_name)
$tcpPort
ForEach($inst in $list_inst) 
{
if ( ( $tcpPort -ne $null) -and ($tcpPort.trim() -ne ""))
  { 
  $buf="`"$mach_name`",`"$inst_name`.$mach_name`",$SNAPID,`"$lsnname$_CPT`",`"$inst_name""

      echo $buf | out-file $OUTPUT_FILE -ErrorVariable ERR1 -encoding "default" -append  #-ErrorAction silentlycontinue
  }
# Si pas de TCP Port
if ($tcpPort -eq "") {
 "Pas de TCP Port"
  exit 2

}
}
}

Open in new window


How can I resolve this problem?

Thanks

bibi
0
Comment
Question by:bibi92
2 Comments
 
LVL 7

Accepted Solution

by:
micropc1 earned 500 total points
ID: 37703899
Have you tried....

echo $buf | out-file $OUTPUT_FILE -ev ERR1 -encoding Default -append -ea SilentlyContinue

Open in new window

0
 

Author Comment

by:bibi92
ID: 37704036
Yes, thanks, I have resolved my problem
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question