I populate my variable with a list of my templates....
$MyTemplates = get-template | Select-Object Name | ft -HideTableHeaders
I get a list of....
server2019_gui
server2019_cor
server2016_gui
server2016_cor
server2016 domaincont_remotesite
server2016 domaincont_homesite
Problem is there are a bunch of spaces at the end of each line.
How do you get rid of those spaces? I tried $MyTemplates.Trim() but no luck and I get errors or I am using that totally wrong........lol
Thanks
You are using the Format-Table cmdlet, which is intended to format text going to the console, to populate a variable.
You should do this as follows
$MyTemplates = Get-Template | Select-Object -ExpandProperty Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You are using the Format-Table cmdlet, which is intended to format text going to the console, to populate a variable.
You should do this as follows
$MyTemplates = Get-Template | Select-Object -ExpandProperty Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference