Hi all,
Anyone knows how, in PowerCLI, set a multiline note on a VM ?
Target goal is to do something like that in VM note:
2020-01-14 - Torrent - Doing something awesome
2019-12-31 - Noobs - Doing blabla
I don't know which chars or which way I have to use to create this new line
Thanks
Try like this.
In PS the backtick-n represents a new-line
Set-VM -notes "Line 1`nLine 2" -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this.
In PS the backtick-n represents a new-line
Set-VM -notes "Line 1`nLine 2" -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried before posting and that's not worked, with simple quote...
With double, that's good
By the way, I need to read this new line fron Read-Host command, and that's not working :
Have you any idea how can I force interpretation of input string ?
Yes, when you populate the variable with Read-Host, the string you enter (with the backtick-n) is not expanded.
You will have to force that expansion.
Get-VM -Name MyVM |
Set-VM -Notes $ExecutionContext.InvokeCommand.ExpandString($answer) -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Perfect, many thanks dude