How to change the output color of test-connection outputHow do I get the color from a hexadecimal color code using .NET?C code changes terminal text color; how to restore defaults? LinuxHow to set the text color of TextView in code?How to change node.js's console font color?Redirect command prompt output to GUI and KEEP COLOR?Hex transparency in colorsChanging color of text background based on conditional statementConvert Test-Connection into BooleanChange output colour in Powershell scriptTest Connection and loop if true or false (change colors…)
Can someone give the intuition behind Mean Absolute Error and the Median?
Two side-by-side squares are inscribed in a semicircle. The diameter of the semicircle is 16. What is the sum of the two squares' areas?
Flowers sent by the birds
Seventh degree polynomial
Why was Logo created?
Why isn't there armor to protect from spells in the Potterverse?
Why did the Soviet Union not "grant" Inner Mongolia to Mongolia after World War Two?
Algorithm that generates orthogonal vectors: C++ implementation
How can I tell the difference between fishing for rolls and being involved?
Are fuzzy sets appreciated by OR community?
Which lens has the same capability of lens mounted in Nikon P1000?
Is it impolite to ask for an in-flight catalogue with no intention of buying?
Why does (inf + 0j)*1 evaluate to inf + nanj?
Intheritance at package visibility in Java
How to justify getting additional team member when the current team is doing well?
Clear text passwords in Unix
What is the difference between an astronaut in the ISS and a freediver in perfect neutral buoyancy?
What happens to a net with the Returning Weapon artificer infusion after it hits?
What would influence an alien race to map their planet in a way other than the traditional map of the Earth
Why does C++ have 'Undefined Behaviour' and other languages like C# or Java don't?
Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?
Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?
Help in drawing resonance structures in case of polybasic acids
Suffocation while cooking under an umbrella?
How to change the output color of test-connection output
How do I get the color from a hexadecimal color code using .NET?C code changes terminal text color; how to restore defaults? LinuxHow to set the text color of TextView in code?How to change node.js's console font color?Redirect command prompt output to GUI and KEEP COLOR?Hex transparency in colorsChanging color of text background based on conditional statementConvert Test-Connection into BooleanChange output colour in Powershell scriptTest Connection and loop if true or false (change colors…)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to change the color of the text depending on the output of the Test-Connection
-quiet cmdlet.
If true green and if False red.
I try to use write-host but without luck
$StartIP = Read-Host -Prompt 'Input Start IP'
$EndIP = Read-Host -Prompt 'Input End IP'
$results= ([int]$StartIP..[int]$EndIP) | % "192.168.128.$($): $(Test-Connection -count 1 -comp 192.168.128.$($) -quiet)"
Read-Host -Prompt "Press Enter to exit"
powershell colors output
add a comment
|
I need to change the color of the text depending on the output of the Test-Connection
-quiet cmdlet.
If true green and if False red.
I try to use write-host but without luck
$StartIP = Read-Host -Prompt 'Input Start IP'
$EndIP = Read-Host -Prompt 'Input End IP'
$results= ([int]$StartIP..[int]$EndIP) | % "192.168.128.$($): $(Test-Connection -count 1 -comp 192.168.128.$($) -quiet)"
Read-Host -Prompt "Press Enter to exit"
powershell colors output
You are not using write-host, also output goes to a variable - where do you expect color to show up?
– LotPings
Mar 28 at 18:44
add a comment
|
I need to change the color of the text depending on the output of the Test-Connection
-quiet cmdlet.
If true green and if False red.
I try to use write-host but without luck
$StartIP = Read-Host -Prompt 'Input Start IP'
$EndIP = Read-Host -Prompt 'Input End IP'
$results= ([int]$StartIP..[int]$EndIP) | % "192.168.128.$($): $(Test-Connection -count 1 -comp 192.168.128.$($) -quiet)"
Read-Host -Prompt "Press Enter to exit"
powershell colors output
I need to change the color of the text depending on the output of the Test-Connection
-quiet cmdlet.
If true green and if False red.
I try to use write-host but without luck
$StartIP = Read-Host -Prompt 'Input Start IP'
$EndIP = Read-Host -Prompt 'Input End IP'
$results= ([int]$StartIP..[int]$EndIP) | % "192.168.128.$($): $(Test-Connection -count 1 -comp 192.168.128.$($) -quiet)"
Read-Host -Prompt "Press Enter to exit"
powershell colors output
powershell colors output
edited Mar 28 at 18:37
LotPings
24.3k6 gold badges17 silver badges33 bronze badges
24.3k6 gold badges17 silver badges33 bronze badges
asked Mar 28 at 18:14
papa0s0papa0s0
52 bronze badges
52 bronze badges
You are not using write-host, also output goes to a variable - where do you expect color to show up?
– LotPings
Mar 28 at 18:44
add a comment
|
You are not using write-host, also output goes to a variable - where do you expect color to show up?
– LotPings
Mar 28 at 18:44
You are not using write-host, also output goes to a variable - where do you expect color to show up?
– LotPings
Mar 28 at 18:44
You are not using write-host, also output goes to a variable - where do you expect color to show up?
– LotPings
Mar 28 at 18:44
add a comment
|
1 Answer
1
active
oldest
votes
Following your existing code:
$start = (Read-Host -Prompt Start) -as [int]
$end = (Read-Host -Prompt End) -as [int]
$start..$end | ForEach-Object
$ip = "192.168.128.$_"
if (Test-Connection -Count 1 -Quiet -ComputerName $ip)
"$ip TRUE"
else
"$ip FALSE"
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55404334%2fhow-to-change-the-output-color-of-test-connection-output%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Following your existing code:
$start = (Read-Host -Prompt Start) -as [int]
$end = (Read-Host -Prompt End) -as [int]
$start..$end | ForEach-Object
$ip = "192.168.128.$_"
if (Test-Connection -Count 1 -Quiet -ComputerName $ip)
"$ip TRUE"
else
"$ip FALSE"
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
add a comment
|
Following your existing code:
$start = (Read-Host -Prompt Start) -as [int]
$end = (Read-Host -Prompt End) -as [int]
$start..$end | ForEach-Object
$ip = "192.168.128.$_"
if (Test-Connection -Count 1 -Quiet -ComputerName $ip)
"$ip TRUE"
else
"$ip FALSE"
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
add a comment
|
Following your existing code:
$start = (Read-Host -Prompt Start) -as [int]
$end = (Read-Host -Prompt End) -as [int]
$start..$end | ForEach-Object
$ip = "192.168.128.$_"
if (Test-Connection -Count 1 -Quiet -ComputerName $ip)
"$ip TRUE"
else
"$ip FALSE"
Following your existing code:
$start = (Read-Host -Prompt Start) -as [int]
$end = (Read-Host -Prompt End) -as [int]
$start..$end | ForEach-Object
$ip = "192.168.128.$_"
if (Test-Connection -Count 1 -Quiet -ComputerName $ip)
"$ip TRUE"
else
"$ip FALSE"
answered Mar 28 at 18:46
TheIncorrigible1TheIncorrigible1
12.5k3 gold badges16 silver badges39 bronze badges
12.5k3 gold badges16 silver badges39 bronze badges
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
add a comment
|
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
Thanks! @TheIncorrigible1
– papa0s0
Mar 28 at 19:27
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55404334%2fhow-to-change-the-output-color-of-test-connection-output%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You are not using write-host, also output goes to a variable - where do you expect color to show up?
– LotPings
Mar 28 at 18:44