Powershell how to setup parameter as variable ?
The code like this:
get-stat -Entity (get-vmhost ) -Disk -Start 'date-time' -Finish 'date-time'
For parameter -Disk, there are other options can be used. I want to setup this parameter as a variable by the following so I can choose what to run for.
$item = read-host -prompt 'Select Disk, CPU, Network or Common'
get-stat -Entity (get-vmhost ) -$item -Start 'date-time' -Finish 'date-time'
But it wont work returning error message "A positional parameter can't be found"
Any solution to that please?