Quantcast
Channel: Microsoft System Center Virtual Machine Manager
Viewing all articles
Browse latest Browse all 504

Sample PowerShell scripts to for networking and storage in SCVMM 2012

$
0
0

scriptHi, I am Nitin Bhat, Program Manager on the SCVMM team. Today I am going to provide you with sample PowerShell scripts to leverage our investments made for networking and storage. These scripts would execute against the SCVMM 2012 Beta builds.

The best part about exposing the fabric information is the level of granularity and extensibility points.

For example in the networking scripts mentioned below, you can drill down from a logical network to all the way an IP Pool entity, MAC Pools, load balancers etc. From a storage perspective in the scripts for storage section, you can drill down from a Virtual machine to a Logical Unit level and then to a storage provider level.

Hope you find these scripts useful.

Scripts for networking

#Connect to SCVMM Server
get-vmmserver localhost | fl Name, Port, IsConnected, FQDN, DatabaseServerName, DatabaseName

#Get all logical networks for the SCVMM server
get-SClogicalNetwork

#Get logical networks existing where the name of the logical network is “backend”
($logicalnetwork= get-SClogicalNetwork | where {$_.Name -eq "backend"}) | fl Name, Description,ServerConnection

#Get logical network definitions existing for this specific logical network “backend”
($logicalnetworkdefinition = get-sclogicalnetworkdefinition | where {$_.LogicalNetwork -eq $logicalnetwork}) | fl Name, HostGroups, SubnetVLans

#Get all IP Pools
get-scstaticipaddresspool | fl Name, IPAddressRangeStart, IPAddressRangeEnd, AvailableAddresses, DNSSuffix, Subnet, TotalAddresses, DNSServers,Logicalnetworkdefinition

#Get all IP Pools existing for a specific logical network definition $logicalnetworkdefinition
(get-scstaticipaddresspool | where {$_.LogicalNetworkDefinition -eq $logicalnetworkdefinition}) | fl Name, IPAddressRangeStart, IPAddressRangeEnd, AvailableAddresses, DNSSuffix, Subnet, otalAddresses, DNSServers, Logicalnetworkdefinition

#Get MAC Pools existing
get-scmacaddresspool | fl Name, Description, MACAddressRangeStart, MACAddressRangeEnd, AvailableAddresses, TotalAddresses, SupportedVirtualizationPlatforms

#Get Load Balancer Information
get-SCLoadBalancer | ft Manufacturer, Model, IPAddress, AvailableProtocols,AvailableLoadBalancingMethods

#Get VIP Templates (Virtual IP templates)
get-scloadbalancerVIP | ft Name, Address, LoadBalancer,LoadBalancingMethod

Scripts for storage

#Connect to SCVMM Server
get-vmmserver localhost | fl Name, Port, IsConnected, FQDN, DatabaseServerName, DatabaseName

#Get virtual machine present on SAN where name of the VM is demo22
($vm = Get-SCVirtualMachine | where {$_.Name -eq "demo22"}) | fl Name, Location, VirtualMachineState, VirtualDiskDrives, VMHost

#Virtual machine to disk drives
$vm.VirtualDiskDrives | fl VirtualHardDisk, BusType, Bus, LUN, ObjectType

#Virtual disk drive to virtual hard disk
$vm.VirtualDiskDrives[0].VirtualHardDisk | fl Location, HostVolume, VMHost

#Virtual hard disk to Host Volume
$vm.VirtualDiskDrives[0].VirtualHardDisk.HostVolume | fl MountPoints, HostDisk, VMHost

#Host Volume to Host Disk
$vm.VirtualDiskDrives[0].VirtualHardDisk.HostVolume.HostDisk | fl DeviceID, UniqueID, SMLunId, StorageLogicalUnit, VMHost

#Host Disk to Storage Logical Unit
$vm.VirtualDiskDrives[0].VirtualHardDisk.HostVolume.HostDisk.StorageLogicalUnit | fl Name, CopyType, SourceLogicalUnit, StoragePool

#Storage logical unit to Storage Pool
$vm.VirtualDiskDrives[0].VirtualHardDisk.HostVolume.HostDisk.StorageLogicalUnit.StoragePool | fl Name, RemainingManagedSpace, TotalManagedSpace, StorageArray

#Storage Pool to Storage Array
$vm.VirtualDiskDrives[0].VirtualHardDisk.HostVolume.HostDisk.StorageLogicalUnit.StoragePool.StorageArray | fl Name, TotalCapacity, RemainingCapacity, IsCloneCapable, IsSnapshotCapable, StorageProvider

#Storage Array to Storage Provider
$vm.VirtualDiskDrives[0].VirtualHardDisk.HostVolume.HostDisk.StorageLogicalUnit.StoragePool.StorageArray.StorageProvider | fl Name, NetworkAddress, TCPPort, StorageArrays

Nitin Bhat

The App-V Team blog: http://blogs.technet.com/appv/
The WSUS Support Team blog: http://blogs.technet.com/sus/
The SCMDM Support Team blog: http://blogs.technet.com/mdm/
The ConfigMgr Support Team blog: http://blogs.technet.com/configurationmgr/
The SCOM 2007 Support Team blog: http://blogs.technet.com/operationsmgr/
The SCVMM Team blog: http://blogs.technet.com/scvmm/
The MED-V Team blog: http://blogs.technet.com/medv/
The DPM Team blog: http://blogs.technet.com/dpm/
The OOB Support Team blog: http://blogs.technet.com/oob/
The Opalis Team blog: http://blogs.technet.com/opalis
The Service Manager Team blog: http: http://blogs.technet.com/b/servicemanager
The AVIcode Team blog: http: http://blogs.technet.com/b/avicode
The System Center Essentials Team blog: http: http://blogs.technet.com/b/systemcenteressentials
The Server App-V Team blog: http: http://blogs.technet.com/b/serverappv

clip_image001 clip_image002


Viewing all articles
Browse latest Browse all 504

Trending Articles



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