Sample PowerShell scripts to for networking and storage in SCVMM 2012
Published Feb 15 2019 06:11 AM 456 Views
First published on TECHNET on May 03, 2011

Hi, 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 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:
The WSUS Support Team blog:
The SCMDM Support Team blog:
The ConfigMgr Support Team blog:
The SCOM 2007 Support Team blog:
The SCVMM Team blog:
The MED-V Team blog:
The DPM Team blog:
The OOB Support Team blog:
The Opalis Team blog:
The Service Manager Team blog: http:
The AVIcode Team blog: http:
The System Center Essentials Team blog: http:
The Server App-V Team blog: http:

Version history
Last update:
‎Mar 11 2019 08:44 AM
Updated by: