Last command at end of script overlapping with Copy right message?/


Does anyone have any idea how I could fix this in my script? I would just like for it to display “Test complete, blah blah blah” without it showing the last command that I ran (in this case the test connection Here’s what I have in my ps1 file:

test-netconnection|Out-File -FilePath .\GTS_Log.txt -Append
Write-Host “Test Complete, you may now close this window, and check your logs!” -ForegroundColor white -BackgroundColor Red
Write-Host “The logs are text files, located in the same directory where this script exists.” -ForegroundColor white -BackgroundColor Red
Write-Host “” -ForegroundColor white -BackgroundColor Red
Write-Host “” -ForegroundColor white -BackgroundColor Red
Write-Host “” -ForegroundColor white -BackgroundColor Red
powershell -noexit

Any advice would be greatly appreciated as this has been driving me nuts!!

Welcome! Please take a moment to go back and edit your post to format your code: Formatting your code: How to format code on

Sometimes, funky things can happen if all the code isn’t formatted as code.

How are you calling the script? Seems like you’re potentially calling it externally or double clicking the file maybe? and its opening your PS window and immediately running. Why not just call the script from PS directly? You also won’t need powershell -noext then either.

Need more info :wink:


Right clicking>Run with Powershell

It’s meant to be used by non-technical people that don’t exactly know how to navigate through Windows directories through a command line.

Won’t it just close out without the -noexit? I added it in order to give the user a visual cue that the script is complete.

Hi, welcome to the forum :wave:

You can hide the copyright message with -NoLogo. You might want to suppress other output too so investigate the various switches with powershell.exe /?

powershell.exe -NoLogo -NoProfile -NonInteractive -NoExit

Personally, I think I’d wait for a keypress or use a popup rather launch another process:

Add-Type -AssemblyName PresentationCore,PresentationFramework
$Title = 'Finished!'
$Message = @"
Test Complete.
Log files can be found in $PSScriptRoot

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.