I am pulling information from a csv. I want to input this data into a Word Document on separate lines.
My csv is something like:
KEY, STIGS
8533, A10 Networks
8533, Active Directory
8533, Video Teleconference (VTC)
8533, Remote Access Policy
8236, Microsoft Outlook 2010
My code look like:
$key = Read-Host “Please enter Key”
$csv = Import-CSV “file.csv”
[string]$key = $key
$csv | where {$.VKEY -eq $key } |Foreach{
[string]$stigs = $.STIGS -join ‘`n’
SearchAWord –Document $Doc -findtext 'STIG ' -replacewithtext $stigs
}
This only inputs the first cell from the csv into the word document. Im assuming something needs to go next to [string]$stigs = $_.STIGS. I tried `n, `r, -join.