Its my first day with powershell scripting I am trying using VMM Cmdlet Get-SCVirtualMachine it works fine when I use it like
PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
But it gives me an error when I try
PS C:\> $vmName = 'VM01'
PS C:\> $VM = Get-SCVirtualMachine -Name "$vmName"
The error I get is
Cannot validate argument on parameter 'Name'. The number of characters (0) in the argument is too small. Specify an argument whose length is greater than or equal to "1" and then try the command again.
Can someone tell me what is it that I am doing wrong?
Thanks