I have the following line which creates the Flag
data in an existing CSV by asking the user to answer with y/n
:
$_ | Add-Member -MemberType NoteProperty -Name Flag -Value (Read-Host "Is $($_.SO) a Planned SO? (y/n) ($($_.ProdProj) - $($_.SrvcTask))")
I would like it to present slightly differently. I've reorganized the text to be more readable and added color to key points, but can't seem to get this to work.
$_ | Add-Member -MemberType NoteProperty -Name Flag -Value (Write-Host "Is " -NoNewline);(Write-Host "$($_.SO)" -ForegroundColor "Red" -nonewline);(Write-Host " a Planned SO?")
(Write-Host "(" -nonewline);Write-Host "$($_.ProdProj) - $($_.SrvcTask)" -ForegroundColor "Yellow" -NoNewline; Write-Host ")"
Read-Host "(y/n)"
Also tried:
(Write-Host "SAM reports this task is " -nonewline);(Write-Host "open (O)" -ForegroundColor "Red" -nonewline);(Write-Host ".
Press " -NoNewline);(Write-Host "[ENTER]" -ForegroundColor "Yellow" -NoNewline); Write-Host " to confirm or type correct status"
$_ | Add-Member -MemberType NoteProperty -Name COPFVR -Value (Read-Host).ToUpper()}
The question appears correctly, but it seems to make the entire document fail to create data and paste it appropriately because the exported data just goes to CSV with the header of Length
and the value of 1
. I remember that happening because it's counting the data and not outputting it, right? The first line can't be a Read-Host
because then it doesn't display the rest of the question before requesting the answer. I can't put parentheses around the entire statement due to the usage of ;
. Is there way to make this work?
Help is appreciated, as always.