title: Set $myVar as a variable with wildcard
body: <p>I have the below script which I had help with from here, one quick question how do you I set <code>$MyVar</code> as  variable, and a wildcard so partial name can be selected.</p>
  
  <pre><code>Select-AzureRmSubscription -SubscriptionName "MySubscription"
  Get-AzureRmResourceGroup | Where-Object {$_.ResourceGroupName -like '$MyVar'} | ForEach-Object {
      $VMs = Get-AzureRmVM -ResourceGroupName $_.ResourceGroupName
      ForEach ($vm in $vms) {
          $tags2 = $VM.tags
          $tags2 += @{ShutdownSchedule_AllowStart="True"; ShutdownSchedule_AllowStop="True" }
  
          Set-AzureRmResource -ResourceName $vm.Name -ResourceGroupName $vm.ResourceGroupName -ResourceType "Microsoft.Compute/virtualMachines" -Tag $tags2 -Force -Verbose
      }
  }
  </code></pre>
  
  <p>Not sure how to set it as a variable. Was thinking maybe <code>{$_.ResourceGroupName -like $('$MyVar')}</code></p>
  
  <p>Or do I need to set it as a parameter, as in a workflow, but not sure how to do that outside a workflow.. </p>