Questions tagged [write-host]
66 questions
0
votes
0 answers
PowerShell - NoNewLine Write-Host parameter in SPLATTING
(If there is something wrong with my english, i apologize in advance) Hi, I don't know much about splatting, I have used it only 2 or 3 times, but this time I have to use it with Write-Host. I would like to add the NoNewLine parameter to the…

Dstr0
- 95
- 2
- 13
0
votes
1 answer
Mutli line comments is not showing up in Email notification from the Manual intervention job in ADO Release Pipeline
EMail BodyCurrently working on a ADO release Pipeline. The First job is a Manual Intervention Job, where a user is notified to approve/Reject the deployment with a comment. The next stage sends out an email notification with the user provided…

saikumar reddy
- 89
- 2
- 9
0
votes
2 answers
What causes Write-Host colors to perform like this?
I am currently playing with the colors in PS ISE. It is a few prompts in which some require only reading and some require user input. I realized that the colors seem to do their own after performing a clear and initializing new write-host commands…

Adam
- 1
0
votes
0 answers
How can I get the PowerShell console information to show in a command window as it is executing from a batch file (.cmd)?
I have a PowerShell script that has really good console status and progress information (using Write-Host) when I run it from PowerShell ISE. However, the script will be normally called by a batch command file (.cmd) as part of a larger process. …

RobP
- 1
- 2
0
votes
1 answer
Powershell Modify Select-Object Property Before Output
How would I go about removing the leading "{Storage consumed:, " and the trailing "}" from the DiskAllocation property of this Select-Object so that only the size remains?
For Example: {Storage consumed:, 48.62 MB} becomes 48.62 MB
I know that I…

TechFA
- 129
- 1
- 9
0
votes
0 answers
Conditionally write output to file for tracing pourposes
I have a script that accept "-outToFilename" as not mandatory parameter with the purpose,if wanted, to have a log on both console and file. Usually I'm using functions like this:
function myLogger {
[CmdletBinding()]
param(
…

pink0.pallino
- 65
- 5
0
votes
2 answers
Is there a short way to Write-Host and save it to a variable?
I am trying to Write-Host message and save it to a variable in shortest possible way.
Currently my code looks like so:
Write-Host "Branch with name $branch_name already exists!`nNew branch has not been created."
$message = "Branch with name…

Mateusz Tryczyński
- 33
- 7
0
votes
1 answer
Equivalent powershell regexp
Is there some non ridiculous (foreach) way to reproduce the linux output with powershell?
echo A{0..9}
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9
Write-Host A(0..9)
A 0 1 2 3 4 5 6 7 8 9
Thank you!
0
votes
0 answers
Extract or Dereference `Name` property from Piped Objects in Powershell
What is the proper way to specify the Name part of the object after a pipe?
Actual Answer Remove the Select from the pipe and go direct such as
dir $staging | Write-Host -ForegroundColor DarkCyan
Setup
I am doing a directory listing to the output…

ΩmegaMan
- 29,542
- 12
- 100
- 122
0
votes
1 answer
How to concatenate 2 Write-Output on the same line?
I wrote a script that can return you if a software is installed or not.
I would like to give it a bit of colors but I don't know how to concatenate 2 Write-Output on the same line as -NoNewline only works for Write-Host... which in this case I…

Francesco Mantovani
- 10,216
- 13
- 73
- 113
0
votes
1 answer
Do-Until loop ask twice value
The problem is with loop DoUntil.
The script must take the URL, than ask what to do with him and gave the result after the user pick the number(1-4)
and with output give the menu again, and user can pick another number if he want or finish the…
user6236445
0
votes
0 answers
Wrong output in PowerShell
$status_message = Get-HPiLoFirmwareversion -Server 172.16.2.210 -Username administrator -Password xxxx -DisableCertificateAuthentication -WarningAction SilentlyContinue |
Select-Object -Property STATUS_MESSAGE
if ($status_message…

IIIdefconIII
- 353
- 2
- 5
- 13
0
votes
1 answer
if/else statement and copy-item issue
Simple script here, well at least I think it should be but I am having issues with the final results:
$a = Get-Content "content\file\location"
$destfile = "destination\of\file"
$source ="source\file\location"
$dest = "c$\destination"
$destfolder =…

NuckinFutz
- 85
- 5
- 18
0
votes
4 answers
How do I write out a string whose length is dependent upon a user's entry's length?
I'm writing a script that has a lot of output, and can take multiple computer names. The output announces the computer name, then a lot of info about that particular computer. I want to have a series of #s above and below where it announces the…

Casspers
- 15
- 1
- 3
0
votes
1 answer
System returning name of class instead of variable
I have a small PowerShell script I'm writing that allows me to grab a user from Active Directory and randomly generate a password for them.
$Alphabet=$NULL
for ($a=48; $a –le 70; $a++) {
$Alphabet += ,[char][byte]$a
}
function…

Austin Kargl
- 89
- 2
- 10