search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
SCVMM – Virtual Machine List Script in Powershell
Posted in Virtual Machine Manager, Windows Powershell | 2 Comments | 34,686 views | 15/04/2009 07:40

This is a basic script about listing vms in Powershell. Output will be Name and Operating System.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
# VM List Script - Yusuf Ozturk
# http://www.yusufozturk.info
$VMProp = Get-VM | Select-Object -Property Name,OperatingSystem
clear-content -path "C:\VMList.txt"
foreach ($i in $VMProp)
{
$VMName = $i.Name
$VMOprs = $i.OperatingSystem.Name
add-content -path “C:\VMList.txt” -value $VMName
add-content -path “C:\VMList.txt” -value $VMOprs
add-content -path “C:\VMList.txt” -value ‘‘
}

You could add more property with using other property names.


Comments (2)

helen

September 17th, 2010
12:24:52

listing vms in Powershell. Output will be Name and Operating System and HOSTNAME:

Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
# VM List Script – Yusuf Ozturk
# http://www.yusufozturk.info
$VMProp = Get-VM | Select-Object -Property Name,OperatingSystem,HostName
clear-content -path “C:\VMList.txt”
foreach ($i in $VMProp)
{
$VMName = $i.Name
$VMOprs = $i.OperatingSystem.Name
$VMHostName = $i.HostName
add-content -path “C:\VMList.txt” -value $VMName
add-content -path “C:\VMList.txt” -value $VMOprs
add-content -path “C:\VMList.txt” -value $VMHostName
add-content -path “C:\VMList.txt” -value ‘‘
}


Laundry Sorter

December 20th, 2010
23:41:38

there are many different operating systems but of course i would still prefer to use linux for stability -:*



Leave a Reply