Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 17778

PowerTip: PowerShell One-Liner to Find Virtual Machine

$
0
0

Summary: Use Windows PowerShell 4.0 to find a virtual machine.

Hey, Scripting Guy! Question How can I use Windows PowerShell 4.0 to find a virtual machine when I only have partial name information so I can stop it or make other changes as required?

Hey, Scripting Guy! Answer Use the Get-VM cmdlet to return virtual machine objects, use the dotted Where, and filter with a script block.
          Add the name property, and use a regular expression (or wild card) to match the virtual machine
          that you are interested in. The following command finds a virtual machine with a name that begins with c1:

(get-vm).Where{$_.name -match '^c1'}


Viewing all articles
Browse latest Browse all 17778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>