Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Method of targeting scope #113

Open
brianbunke opened this issue Mar 30, 2017 · 2 comments
Open

Method of targeting scope #113

brianbunke opened this issue Mar 30, 2017 · 2 comments
Labels

Comments

@brianbunke
Copy link
Contributor

brianbunke commented Mar 30, 2017

Currently, filtering each scope consists of Get-VM -Name YOURINPUTHERE & similar for other scopes.

That's ok, but leaves room for improvement. For example, Get-VM -Tag YOURTAGHERE would be a pretty sweet option.

Is that enough? Should we allow people to fully craft their own queries? That would allow Get-VM | Where Name -notlike 'abc'. Get-VM -Datastore YOURDATASTOREHERE is also a thing. Get-VM may have another useful parameter, or more useful parameters in the future. Who knows how many useful filtering parameters exist on the rest of the scopes right now.

However, currently, we're actually doing:

Get-Datacenter -Name $cfg.scope.datacenter -Server $cfg.vcenter.vc |
    Get-Cluster -Name $cfg.scope.cluster |
    Get-VM -Name $cfg.scope.vm

Will people know to replicate that, or realize that parent scopes may not apply? We could display, on-screen, the results of your query (like after you set it in New-VesterConfig), but some people have thousands of VMs, so I've held off on doing that.

I personally think inventory tags are sweet, and enough to solve this problem. But I'm interested in your feedback before I get started!

@midacts
Copy link
Contributor

midacts commented Mar 31, 2017

I think it is a good idea to allow for custom filtering.
I personally like the Get-VM | Where-Object {"server1","server2" -notcontains $_.Name} (Because not many people use tags where I work. I can't trust our admins to tag things appropriately)

@brianbunke
Copy link
Contributor Author

Another option that we discussed in the Slack channel last night:

Get-VM | Where Name -ne 'asdf' | Invoke-Vester

Accepting piped VIObjects would either overwrite the scope settings in your config file on that run, or completely eliminate them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants