Get IP address of virtual machines running on Hyper-V – FIXED!

Big thank you – goes to Max Trinidad my fellow MVP from Powershell group…
Here is errorless script – much better than mine! 🙂
Copa, paste and save as .ps1 – then run on your Hyper-V server and you will get IP’s of your virtual machines…

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

## – Use Line below to list all your Virtualization Class
#get-wmiobject -namespace “root/virtualization” -list

## – Load filter (or function first)
filter Import-CimXml{

    $CimXml = [Xml]$_
    $CimObj = New-Object -TypeName System.Object
   
    foreach ($CimProperty in $CimXml.SelectNodes(“/INSTANCE/PROPERTY”)){
        if ($CimProperty.Name -eq “Name” -or $CimProperty.Name -eq “Data”){
            $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
        }
    }
   
    $CimObj
}

## – Collect WMI Virtual information
$getWmiVirtual = Get-WmiObject -Namespace “rootvirtualization” -Query “Select * From Msvm_ComputerSystem” | sort-object elementname

## – Build your results from your collected objects
ForEach($v in $getWmiVirtual){
    $vm = $v.ElementName;
    $VmObj = Get-WmiObject -Namespace “rootvirtualization” -Query “Select * From Msvm_ComputerSystem Where ElementName=’$vm'”;
    $KvpObj = Get-WmiObject -Namespace “rootvirtualization” -Query “Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent”;
    if($KvpObj.GuestIntrinsicExchangeItems -ne $null){
        write-host $vm;
        $KvpObj.GuestIntrinsicExchangeItems | Import-CimXml | where {$_.NAME -match “NetworkAddressIPv4”} | ft;
    }
}

## – End of Script

Get IP address of virtual machines running on Hyper-V

I have been searching for an easy solution to somehow “scan” virtual machines and get their IP addresses becouse sometimes you need to find your virtual machines and it is more practical to somehow get a whole list of machines + IPs in stead of loging in from machne to machine and check IP… Well it can be done using Powershell… I have encountered an article but the problem is that here you need to put machine name on which you want to get data… I modified this script a bit so it looks like:

Get-WmiObject -Namespace rootvirtualization -Query “Select * From Msvm_ComputerSystem”| sort-object elementname | ForEach-Object {$vm = $_.Elementname
write-host $vm
filter Import-CimXml
{
    $CimXml = [Xml]$_
    $CimObj = New-Object -TypeName System.Object
    foreach ($CimProperty in $CimXml.SelectNodes(“/INSTANCE/PROPERTY”))
    {
if ($CimProperty.Name -eq “Name” -or $CimProperty.Name -eq “Data”)
{

         $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE

}
    }
    $CimObj
}
$VmObj = Get-WmiObject -Namespace rootvirtualization -Query “Select * From Msvm_ComputerSystem Where ElementName=’$vm'”
$KvpObj = Get-WmiObject -Namespace rootvirtualization -Query “Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent”
$KvpObj.GuestIntrinsicExchangeItems | Import-CimXml
} | where {$_.NAME -match “NetworkAddressIPv4”} | ft
read-host

So… Copy paste this script to an text file and save it as getip.ps1 and run it using powershell – it does need any other modules you should only run it on Windows Server where you have Hyper-V role installed… (I do not remember but I think you should enable execution policy for ps1 scripts… If you have truble executing your ps1 check here…)

By the way… This script has an error first virtual machine name will not fit in table (I do not know why 🙂 ) and you will get an error when this script will try to analyze your Hyper-V host machine… I do not know how to solve this two errors if someone out there solves it please provide feedback. 🙂 Thank you!

SBS 2011 – Import PST in Exhange 2011

To enable import and export of mailboxes on SBS 2011 you need to:

Go to Windows SBS console and create a security group – that shuld be universal (by default) for example: Mailbox management

Add administrator / admin account to the group

Then you need to enable “import / export” feature on members of this group. To do that you need to open Exchange Management Shell (Powershell with Exchange 2010 modules) as administrator and write:

New-ManagementRoleAssignment -Name “Import Export Mailbox Admins” -SecurityGroup “Mailbox management” -Role “Mailbox Import Export”

After that you can folow my article to import or export mailboxes

Happy migration :) Exchange 2003 to Exchange 2010 SP1

We have setup a completely new environment with Exchange 2010 SP1… Old Exchange 2003 had around 100 mailboxes with quota from 300 MB – 1GB. I used Exmerge to export all mailboxes from Exchange 2003 (using ExMerge to extract PSTs from Exchange 2003 database) and sucessfuly used new Powershell cmdlets to import them to users in Exchange 2010…

You first need to add permissions to a group in which you put administrator to be able to use import / export features. You can read about that in this article.

Useful comdlets are:

Importing pst to existing mailbox:

New-MailboxImportRequest -FilePath \oldservershareuser1.pst -Mailbox user1

To check status of your import type:

Get-MailboxImportRequest | Get-MailboxImportRequestStatistics

If import fails you can try with option:

New-MailboxImportRequest -FilePath \oldservershareuser1.pst -Mailbox user1 -BadItemLimit 10

What it does? Saso (tnx man!) explained to me, that it might happen when you have used some antivirus solution that has “corrupted” some e-mails… So try with BadItemLimit 10 probably we are talking about one or two e-mails with problems.

If you want to remove old importrequest you can use:

Remove-MailboxImportRequest -Identity usernameMailboxImport or MailboxImport1 or 2…If you want to look at just a signle mailbox import progress you can use modified cmdlet:

Get-MailboxImportRequest -Identity usernamemailboximport | Get-MailboxImportRequestStatistics

At the end you will have alot of Completed malilboximport’s… If you want to cleane up your exchange you can run:

Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest

Happy importing! 🙂

IPv6 is comming… Get some knowledge and get certified…

IPv4 address space is comming to an end… For all you there is an easy solution to get some knowledge and do some practice using IPv6 – the new generation of IP on http://ipv6.he.net/certification/

It is realy hard to move on in technology if you do not know what exercises to do and what to try… Hurrican Electric certification process will guide you through some basic and more advanced IPv6 tasks… Just go ahead and try… It’s free!

IPv6 Certification Badge for manojlovicl

Running Exchange 2010 on public IPv4 and IPv6…

Yey! Today I have put a testing Exchange 2010 online to make my “exam” on Hurricane Electric IPv6 certification program… Well what I did is to put two extra DNS records to my DNS one with IPv4 “A” record pointing mail.ipv6.testingdomain.com to some IPv4 address and another “AAAA” record pointing mail.ipv6.testingdomain.com to an IPv6 address where my Exchange 2010 is listening…
Then I have added an MX record for domain ipv6.testingdomain.com to point on mail.ipv6.testingdomain.com.
Great! Everything works? NOT! 🙂

If you want your Exchange 2010 to receive mail from IPv6 mail servers you need to configure your receive (and send) connector to listen on IPv6 address of your server…

 Let’s configure Internet receive connector that is listening on fqdn in my example mail.ipv6.testingdomain.com First you need to add IPv6 address on which your server is listening on…

 

By default your server will accept only traffic from IPv4 world so we need to add IPv6 range…

 

 Let’s do it…

 

 Here goes the tricky part… If you think about an IPv6 address you always thing about 8×16 bit separated by colon… And logical solution would be to insert beging of range 0000:0000:0000:0000:0000:0000:0000:0000 and the same for FFFF:FFFF:FFFF… eight times… But no… You need to replace last two segments of 16 bits with 32-bit IPv4 represntation… So you need to insert:

Windows Phone 7 – Active Sync issue… 80072F06 when using self-signed certificate

I am a proud owner of a brand new Windows phone 7 (running on Samsung Omnia…)! 🙂 As soon as I did unpacked my phone I wanted to sync it with my Exchange server… I am using a self-signed certificate and first I had to install the certificate… Ok, you have two options here… You can go to https://mail.domain.com/certsrv and install a certificate directly from your certification authority or somehow put it on your phone by sending it to your email that you can access using web browser on Windows Phone 7…

Ok… To this step everything fine… But now I want to sync and I receive an error saying…

There is a problem with the certificate for mail.domain.com. Contact a support person or your service provider. Error Code: 80072F06

Hmm.. I tried to open my Outlook web access using web browser on my Windows Phone 7 and it worked without any problem – no certificate error warning… So I was realy confused now… My certificate is installed and I do not get any error what the hell is wrong with Active Sync now?

Well… You need to “reboot” your phone and everyting will start to work 🙂

So press the power button and hold it for a few seconds until you receive a “Goodbye” on phone screen… After turning it back I tried to sync again and TADA! Everything is working now!

Peace and love,
Luka

Sinergija 2010 q&a 2 – sbs 2008 / sbs 7 – tips and tricks

Here are answers to the questions that we were discusing on my session @ Sinergija 2010

Wsus and port question:
http://www.wsus.info/index.php?showtopic=10906
http://www.wsuswiki.com/WSUSServerFAQ

Console crash reasons?
http://blogs.technet.com/b/sbs/archive/2009/03/12/sbs-console-crashes-when-duplicate-entries-from-av-products-are-written-into-security-center.aspx

Migration? Check this out:
http://www.sbsmigration.com/

Backup solutions for SBS 2008 – we had a presentation on Slovenian Small Business Specialists Community SI try this one…
http://www.backupassist.com/index.html