Home > Software engineering >  Output variable property value in Read-Host PowerShell
Output variable property value in Read-Host PowerShell

Time:11-12

How to output value of a variable property in Read-Host/Powershell

@Answer = Read-Host -Prompt "Power Off $VM.Name yes/no"

I tried with ($VM.Name) and ($VM).Name which is not working.

CodePudding user response:

To expand the property you have to use $($VM.Name)

Read-Host -Prompt "Power Off $($VM.Name) yes/no"
  • Related