I’ve got some tools that give me reports every so often of a list of names. Example:
Joe L. Smith Josh A. North Sandy P. Garnett
I’d like to modify these lists so that I can import them into PowerShell. Perhaps I’m doing it wrong, but so far when I have copy pasted these lists in to put in a variable, calling $Variable[0] returns only the first letter of the first name, not the entire first name.
Is there a fast way to modify this list so a single quote shows up at the beginning of each line, and a single quote followed by a comma shows up at the end of each line?
EDIT:
Realized I was mixing two things in my mind, but this will work either way. Actual goal was pull a list of computers, then pass a command to them.
Per /u/Old-Lost here’s a sample of the list I have, and what I was doing to grab it and put it into code:
Computer1 Computer2 Computer3
Sample of what I was looking to do:
$Comptuers = ' Computer1 Computer2 Computer3'
Result when I call $Computers[0]
C
Ideas?
submitted by /u/NtGuru
[link] [comments]
The post Easy Way to Modify a List For Import into POSH? appeared first on How to Code .NET.