It's more so the frame of this post, laced run-ons with poor punctuation and grammar, with a bunch of non-sense.
Not to say he normally doesn't speak in non-sense.
I'm not at all computer, but I believe Out-Null
is used as "don't give me any output", Out-File
is used as "put the output in this file", and Out-Host
is similar to the standard output in the terminal.
What I would do is something like this (I'm not at a computer to test this):
Copy-Item "$SourceRoot\$SourceFolder\$SourceFile" -Destination "$DestinationRoot\$DestinationFolder" -Verbose *>&1 | Out-File -FilePath "$LogFile" -Append ; if(Test-Path "$DestinationRoot\$DestinationFolder\$SourceFile"){ Write-Host "Success!" } else { Write-Host "Failed!!!" }
Or if you want the actual output, this will store the result to the file and the screen/host:
Copy-Item "$SourceRoot\$SourceFolder\$SourceFile" -Destination "$DestinationRoot\$DestinationFolder" *>&1 | Tee-Object -FilePath "$LogFile" -Append | Out-Host
Not sure if I'm missing something here, but that scans ports on the localhost, it is not a port scan of your entire network. While that's still crazy and not something you want, it's not quite what you initially said, and I don't believe they'd be able to scan outside of your machine