So I’m trying to do something i thought was simple here. Grab a csv file taht just has a single column labedl ‘ComputerName’ and then allow a admin to select the computers and pipe that to a variable. Finally i just want to spit out the list the admin just selected and ask tehm to verify that is what the selected. The first iteration of the code below will show nothing in the console. If you select N and redo the selection it will then correctly display the $computer list…What am i missing?
$Accepted -eq "N"
Do
{
Write-Host "Select Computers"
$Computers = Import-Csv C:\Computers.csv | Out-GridView -PassThru -Title "Select the Computers to work with"
$Computers
$Accepted = Read-Host "Is the list valid? (Y or N):"
}
Until ($Accepted -eq "Y")
Thanks Olaf! This one was just driving me nuts. I appreciate the pointers. I do have a header in the file. Would you expand on why calling $computers like I did wouldn’t work on the first iteration? You go me past my issue but I still don’t understand the ‘why’ of it. Either way, thanks again!