Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9280659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:55:33+00:00 2026-06-18T17:55:33+00:00

I’m using Windows 2003 Server x86, Powershell 1.0 and have following head-breaking problem. When

  • 0

I’m using Windows 2003 Server x86, Powershell 1.0 and have following head-breaking problem. When I’m trying to execute script below, I’m getting an error:

Error "=" operator: System error. (Fehler beim "="-Operator: Systemfehler.)
+ $data =  <<<< Get-Content $log | % {

Here is this script:

$log = "C:\log file.txt"
$linePrefix = "PROCESS THIS LINE"
$trimStart = 25 #chars to ignore in the beginning
$started = 0

$data = Get-Content $log | % { 
    if ($_.length -ge $trimstart) { 
        $linedata = $_.substring($trimstart);
        $timesline = $linedata.startswith($lineprefix); 
        if ($started -eq 0 -and $timesline) { 
            $started = 1; 
        }
        if ($started) { 
            if ($timesline) { 
                $line = $linedata.substring($lineprefix.length).trimstart();
                if ($line.contains(": ")) {
                    write-output $line 
                } 
            } else { 
                break; 
            }
        }
    }
}

However, if I execute it without $data = assignment, it works perfectly and returns me expected values. I’ve also tried following statements

$data = (...)
$data = $(...)

and declaring a function with expression but without success.

Could you please give me a hint why it does happen?

UPDATE: I’ve tried to remove spaces before and after assigment sign and got similar error, but now powershell didn’t like $data=G string

Error "=" operator: System error (Fehler beim "="-Operator: Systemfehler.)
At C:\kosmo\scripts\ps\test.ps1:60 Symbol:7
+ $data=G <<<< et-Content $log | % {
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T17:55:34+00:00Added an answer on June 18, 2026 at 5:55 pm

    Thanks all to your hints! Pity, but nothing suggested solved my problem indeed.
    Most helpful was hint from latkin about break behavior. After some reading I found out, that in Foreach-Object cmdlet, which is aliased by %, break or continue statements stop whole script

    function getFilteredResult {
    
        1..50 | % { 
            if ($_ -le 20) { 
                if (($_ % 2) -eq 0) {
                    write-output $_;
                }
            } else {
                break; #terminates whole script, you don't even get "after got result"
                #continue; #save result as break
            }
        }   
    }
    
    Write-Host "before getting result"
    
    $result = getFilteredResult
    
    $result | % {$i=0}{ ++$i; Write-Host "$i) $_" }
    
    Write-Host "after got result"
    

    Output shows only before getting result. From there I’ve made a conclusion that there is no way to do what I want in Powershell 1.0! So I found a way to install Powershell 2.0 on my good old 2003 server (tip how to uninstall Powershell 1.0 before; btw, my Windows-update had name KB926140-v5).

    Ok, error has gone. But I still have no result I want to have?! At the end of my journey I found very useful post and have written script below

    function getFilteredResult {
        Try {
            1..50 | % { 
                if ($_ -le 20) { 
                    if (($_ % 2) -eq 0) {
                        write-output $_;
                    }
                } else {
                    #break; #terminates whole script, you don't even get "after got result"
                    #continue; #terminates whole script, you don't even get "after got result"
                    throw "terminated pipeline!"
                }
            }   
        } Catch {
            #ignore terminated pipeline exception
        }
    }
    
    Write-Host "before getting result"
    
    $result = getFilteredResult
    
    $result | % {$i=0}{ ++$i; Write-Host "$i) $_" }
    
    Write-Host "after got result"
    

    And got an answer:

    before getting result
    1) 2
    2) 4
    3) 6
    4) 8
    5) 10
    6) 12
    7) 14
    8) 16
    9) 18
    10) 20
    after got result
    

    Explanation
    If I’d used foreach statement, I could use break with estimated behavior, but I’m working with large log files and foreach-statement reads whole file into memory, while ForEach-Object cmdlet processes lines one by one. I’m not sure about Get-Content cmdlet, maybe it also reads whole file to return it, but I’ve written down my own cmdlet Get-Content-Reversed to read lines from the end of file and that’s why I’m pretty sure it doesn’t

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have an autohotkey script which looks up a word in a bilingual dictionary
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have thousands of HTML files to process using Groovy/Java and I need to
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.