I have the code below where it grabs info from a CSV file. The problem is that, not everyone have a title, or a desk phone, or a cell phone. I’m able to write if title is NULL, don’t read at line. This is working.
I was wondering if there’s a way in PowerShell to tell it if any of these (Name, Title, Street, etc) is NULL, don’t read that line?
I hope I’m being clear on what I’m asking.
(Get-Content $html_files_location\$txt_file_names) `
-creplace ("NAME",$employees.Name) `
-creplace ("TITLE",$employees.Title) `
-creplace ("STREET", $employees.Street) `
-creplace ("ADDRESS_INFO", $employees.Address_info) `
-creplace ("PHONE", $employees.Phone) `
-creplace ("CELL", $employees.Cell) `
-creplace ("WEBSITE", $web) `
-creplace ("ADURL", $web.Trim("http://")) `
-creplace ("LOGO", $logo) ` |
Set-Content $html_files_location\$txt_file_names -Force