$pg1fa1="52:4a:93:78:34:06:21:00;52:4a:93:78:34:06:21:02;52:4a:93:78:34:06:21:04"
$array_name="storage01"
$a=$array_name.Substring(8) 
Write-Host "pg$($a)fa1"
I want output of $pg1fa1 variable but i am getting pg1fa1 as output.
$pg1fa1="52:4a:93:78:34:06:21:00;52:4a:93:78:34:06:21:02;52:4a:93:78:34:06:21:04"
$array_name="storage01"
$a=$array_name.Substring(8) 
Write-Host "pg$($a)fa1"
I want output of $pg1fa1 variable but i am getting pg1fa1 as output.
If the name of a variable is variable, pun intended, you can use Get-Variable like in the example below
$pg1fa1="52:4a:93:78:34:06:21:00;52:4a:93:78:34:06:21:02;52:4a:93:78:34:06:21:04" 
$array_name="storage01" 
$a=$array_name.Substring(8) 
Write-Host (Get-Variable "pg$($a)fa1").Value