Hello people,
I have an list of Azure VM and I want checking if this VM still available on the environment.
I try to use this script:
$vms = import-csv -Path C:\temp\vm.csv
$vms | ForEach-Object { Get-AzureRmVM -Name $vms.Name}
But when I run this, return the error:
Get-AzureRmVM : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported.
At line:2 char:54
+ $vms | ForEach-Object -Process { Get-AzureRmVM -Name $vms.Name}
+ ~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzureRmVM], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Azure.Commands.Compute.GetAzureVMCommand
Please, can anyone help me with this?
Tks