Just a simple note about a new cmdlet in PowerShell 3.0. Show-Command is something very useful if you try out a new PowerShell Command. It shows all the options and possible parameters you have with the cmdlet.
Show-Command Get-Childitem

Some days ago the Microsoft Powershell Team released the Community Technology Preview of the Windows Management Framework 3.0 which includes Windows PowerShell v3. You can download the the CTP1 here and it requires Windows 7 SP1 or Windows Server 2008 R2 with SP1.
You can use very easy both PowerShell versions sie by site.
powershell.exe -Version 3.0 powershell.exe -Version 2.0
But the Windows Management Framework 3.0 CTP1 does not only includes PowerShell 3, it also contains new versions of WMI, WinRM and the new Windows PowerShell Webservice.
Windows PowerShell Web Service enables an administrator to expose a set of PowerShell cmdlets as a RESTful web endpoint accessible via the Open Data Protocol (OData). This provides remote access to invoke cmdlets from both Windows and non-Windows clients.
You can get more Information about the Windows Management Framework 3.0 Community Technology Preview on the Windows PowerShell Team Blog.
Microsoft showed the latest version of Hyper-V at build conference together with Windows 8 and Windows Server 8. Microsoft showed a lot of new Hyper-V features which turn Hyper-V in really powerful hypervisor.
Some days ago I posted a blog post about new features which Microsoft showed before the build conference, now it’s time to extend the list of new features. There are a lot of even more powerful features than the once I posted back then.
First let’s start with Windows Server 8 as the base of Microsoft Cloud strategy. Microsofts focus in Windows Server 8 was to make it easy for all to build public and private cloud solutions. There are a lot of improvements to manageability, security, scalability, extensibility, predictability and reliability which will also improve the possibilities with Hyper-V. In technical terms Microsoft made a lot of improvements how you can manage a lot of servers and services, Storage, Networking and Powershell. Of course there is a lot more, but this are the parts I think are the most important. And here are some keywords to the improvements in Windows Server 8:
Hyper-V gets not only a lot of improvements to Virtual Machine, also the Hyper-V Hosts get some new limit improvements.
Microsoft did a lot to extend the existing Virtual Machine hardware to support even high workload Virtual Machines. I will not write a lot about this because the facts here will tell more that a lot of words.
Hyper-V got a lot of improvements in terms of networking. Microsoft realized that networking features are really important if you start to create private and public cloud scenarios and now even create a mix of public and private cloud scenarios without creating a lot of work for the IT teams to reconfigure Virtual Machines.
Hyper-V gets also a lot of Cluster improvements. But you have to be aware that Clusters are for really high availability and this adds a lot of costs to projects and solutions. Microsoft is working on Cloud solutions which will give great availability to low cost. For example Hyper-V Replica or Live Migration to another host over the Ethernet without the need for a shared storage. But if you need real HA you will need the Failover Cluster.
A I mentioned earlier Microsoft made a lot of improvements in terms of storage in Windows Server 8 and Hyper-V can take advantage of those which are quiet impressive. For example with the new features in SMB 2.2 you can now use SMB file shares to store your Virtual Machines.
As everywhere in Windows Server 8 PowerShell is the key. And the new Server Manager Dashboard Microsoft enable to create Server Groups to manage multiple servers from a single console.
Now I think this is maybe the greatest new feature. You can now live migrate a Virtual Machine from one Hyper-V Host to another without Shared Storage or Cluster configuration. And with this option Microsoft also included a new feature called Hyper-V Replica which includes the option to replicate Virtual Machine to another host which can be hosted in the same network or even in the cloud.
This are not all of the new features Windows Server 8 Hyper-V has to offer but I tried to list the important ones. And if Microsoft sticks with their licensing model, it will be a really strong competitor to the VMWare vShpere 5.
I have created a small Powershell Script which will you remind of existing VM Snapshots. You can use this and create a scheduled task for example each morning and it will send you an email with all existing VM snapshots or checkpoints. The Script uses the Powershell Commands of System Center Virtual Machine Manager 2008 R2 but should also work with System Center Virtual Machine Manager 2012.
# Check for Virtual Machine Manager Snapin
$PSSnapin = Get-PSSnapin | Where-Object { $_.Name -eq "Microsoft.SystemCenter.VirtualMachineManager" }
if($PSSnapin -eq $null)
{
Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager
}
# Connect to SCVMM Server
Get-VMMServer localhost
# Get Snapshots
$snapshots = Get-VMCheckpoint
# Check for existing Snapshots
if ($snapshots.count -gt 0){
# Create the List of Snapshots
$info = $snapshots | Format-Table VM, AddedTime, Name -auto | Out-String
# Mail Configuration
# ==================
# Configuration
$emailFrom = "user@mydomain.com"
$emailTo = "user@yourdomain.com"
$emailSubject = "VM Snapshot Reminder"
$emailMessage = "You have still some snapshots: `n `n" + $info + "`n Greetings your SCVMM Server"
$smtpServer = "mail.server.com"
$smtpUserName = "username" # This could be also in e-mail address format
$smtpPassword = "password"
$smtpDomain = ""
# SMTP Object
$smtp = New-Object System.Net.Mail.SmtpClient($smtpServer)
$mailCredentials = New-Object System.Net.NetworkCredential
$mailCredentials.Domain = $smtpDomain
$mailCredentials.UserName = $smtpUserName
$mailCredentials.Password = $smtpPassword
$smtp.Credentials = $mailCredentials
# Send E-Mail
$smtp.Send($emailFrom, $emailTo, $emailSubject, $emailMessage)
}

This is a small script which you can use to send E-Mail from Windows Powershell. This script has an hardcoded password variable because this solution is mostly used for automation. But you could also use the get-credentials command to get the credentials from a user.
# Configuration $emailFrom = "user@mydomain.com" $emailTo = "user@yourdomain.com" $emailSubject = "my subject" $emailMessage = "my message" $smtpServer = "mail.server.com" $smtpUserName = "username" # This could be also in e-mail address format $smtpPassword = "password" $smtpDomain = "" # SMTP Object $smtp = New-Object System.Net.Mail.SmtpClient($smtpServer) $mailCredentials = New-Object System.Net.NetworkCredential $mailCredentials.Domain = $smtpDomain $mailCredentials.UserName = $smtpUserName $mailCredentials.Password = $smtpPassword $smtp.Credentials = $mailCredentials # Send E-Mail $smtp.Send($emailFrom, $emailTo, $emailSubject, $emailMessage)
Update:
Thanks to Jeffery Hicks for correcting me, since Powershell v2 there is a much easier way to send a Mail with the Send-MailMessage cmdlet. http://go.microsoft.com/fwlink/?LinkID=135256

This maybe helps some people which need to copy mutiple files. In my example I search for Contoso in files called info_*****.txt I need to copy them and also copy the file data_*****.txt.
$sourceFolder = "E:\temp\source"
$destinationFolder = "E:\temp\folder1"
$files = Get-ChildItem $sourceFolder -Filter *.txt -Recurse | Select-String "Contoso" # Get all Files with Contoso
Write-Host "Files found: " $files.count # Number of files found
foreach ($file in $files){
Get-Childitem $sourceFolder | Where-Object { $_.name -eq $file.filename } | Copy-Item -Destination $destinationFolder # copy all info_*****.txt files
$name = $file.filename -replace "info_", "data_"
Get-Childitem $sourceFolder | Where-Object { $_.name -eq $name } | Copy-Item -Destination $destinationFolder # copy all data_*****.txt files
}
More Infos about Select-String and file copy