Solved

Unexpected token 'default" -append  #-ErrorAction silentlycontinue

Posted on 2012-03-09
2
774 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

623 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