During the roadshow we have done a lot of demos and most of the demos are based of scripts (PowerShell mainly) and we promised make sure that all our attendees could download them, so here they are.
You will find the rest of the scripts here http://www.deploymentresearch.com/Research/tabid/62/EntryId/190/Sample-files-and-links-from-The-Ultimate-Event-II-roadshow.aspx
First Session: Getting data from SCVMM and Active Directory
#Get the number of VM’s
Get-SCVirtualMachine | Measure-Object
#Get all MACaddresses, group them and it is very easy to see if you have more then one nic with the same mac twice
Get-SCVirtualMachine | Select-Object -ExpandProperty VirtualNetworkAdapters | Group-Object MACAddress
#Get all the OS you are running and the amount of each version
Get-SCVirtualMachine | Group-Object OperatingSystem | Sort Count -Descending | Select Name, Count
#Get the number of unknown OS running in your fabric
Get-SCVirtualMachine | Where-Object { $_.OperatingSystem -like “Unknown” } | Group-Object Cloud | Select-Object Name, COunt
#Get all VM’s that are running on a snapshot, including the name and the date of the snapshot
Get-SCVirtualMachine | Select -ExpandProperty VMCheckpoints | Select VM, AddedTime
#Get the number of VM’s using a dynamic MacAddress
Get-SCVirtualMachine | Select -ExpandProperty VirtualNetworkAdapters | Where { $_.MACAddressType -eq “Dynamic” } | Measure-Object
#Get all the VM’s that are using a dynamic MacAddress
Get-SCVirtualMachine | Select -ExpandProperty VirtualNetworkAdapters | Where { $_.MACAddressType -eq “Dynamic” } | Select Name
#Get All Servers from OU,s and then get the nams and IP’s
$Servers = @(Get-ADComputer -Filter * -Properties ipv4Address, OperatingSystem -SearchBase “OU=Server,OU=Cloud,DC=cloud,DC=truesec,DC=com”)
$Servers += @(Get-ADComputer -Filter * -Properties ipv4Address, OperatingSystem -SearchBase “OU=Domain Controllers,DC=cloud,DC=truesec,DC=com”)
$Servers | Select-Object DNSHostName,ipv4Address | Out-GridView
Second Session: Ref Image and CustomSettings.ini
The sample files for customsettings.ini can be found here:
- Back to Basic – CustomSettings.ini – Explained
- Back to Basic–CustomSettings.ini–Sample 1
- Back to Basic–CustomSettings.ini–Sample 2
- Back to Basic – CustomSettings.ini – Sample 3 and a bunch more
- VN Wrapper for all VC++
/mike
Categories: RoadShow
If we’re getting picky, the first one should probably read:
(Get-SCVirtualMachine | Measure-Object).Count
If you just need the number, yes. However, this is one of those commands I just to just get me the number, fast. But if you need to use the count in a script, you are absolutely correct.