Avatar of bibi92
bibi92
Flag for France asked on

Unexpected token 'default" -append #-ErrorAction silentlycontinue

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
Powershell

Avatar of undefined
Last Comment
bibi92

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Chris Ashcraft

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
bibi92

ASKER
Yes, thanks, I have resolved my problem
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck