Posts RSS Comments RSS 253 Posts and 407 Comments till now

Hyper-V and PowerShell : VMName to OSName mapping

I have been working on creating a Hyper-V app for Splunk that will allow Splunk users to associate Hypervisor data with products like XenDesktop, XenApp, and Exchange. One of the challenges I came across is mapping the Hypervisor VM name to the OS FQDN.

Thanks to Artem

Function


function Get-VMDetails
{
    Param(
        [Parameter()]
        $ComputerName = $Env:ComputerName,

        [Parameter()]
        $VMName

    )

    # Creating HASH Table for object creation
    $MyObj = @{}

    # Getting VM Object
    $Vm = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName=’$VMName’" -ComputerName $ComputerName

    # Getting VM Details
    $Kvp = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent" -ComputerName $ComputerName

    # Converting XML to Object
    foreach($CimXml in $Kvp.GuestIntrinsicExchangeItems)
    {

        $XML = [xml+site:msdn.microsoft.com”>XML]$CimXml

        if($XML)
        {
            foreach ($CimProperty in $XML.SelectNodes("/INSTANCE/PROPERTY"))
            {
                switch -exact ($CimProperty.Name)
                {
                    "Data"      { $Value = $CimProperty.VALUE }
                    "Name"      { $Name  = $CimProperty.VALUE }
                }
            }
            $MyObj.add($Name,$Value)
        }
    }

    # Outputting Object
    New-Object -TypeName PSCustomObject -Property $MyObj
}

Output looks like


RDPAddressIPv6             :
OSName                     : Windows Server 2008 R2
EnterpriseOSMajorVersion   : 6
ServicePackMinor           : 0
ProductType                : 3
OSPlatformId               : 2
SuiteMask                  : 18
CSDVersion                 : Service Pack 1
OSVersion                  : 6.1.7601
FullyQualifiedDomainName   : bd-xa60-01.home.lab
OSMinorVersion             : 1
NetworkAddressIPv6         : fe80::78e4:e94b:b5c0:be0b%12
OSBuildNumber              : 7601
ProcessorArchitecture      : 9
RDPAddressIPv4             :
ServicePackMajor           : 1
NetworkAddressIPv4         : 192.168.0.105
OSEditionId                : 10
IntegrationServicesVersion : 6.1.7601.17514

Powershell v2 is yours!

Windows Management Framework, which includes Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0, was officially released to the world this morning. IT Professionals can now easily manage their Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2 machines through PowerShell remoting.

Click this link for the list of packages for each OS: Description of the Windows Management Framework on Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008

blog: WS2008 R2 Active Directory Webcast – Tomorrow, Friday 4/24

Tomorrow Laura Hunter and Brian Desmond will be doing a webcast discussing and premoting the new Active Directory features in Windows Server 2008 R2 as well as answering AD questions. They have a 90 minute slot and they expect to spend ~45-60 minutes on R2 and the remainder taking questions on the presentation and AD in general.

The webcast is hosted by O?Reilly and is free to attend. If you can?t make it, a recording will be available.

Here are the details:

Registration Link - HERE

Date: Friday, April 24, 2009

Time: 10am PT, San Francisco
6pm - London | 1pm - New York | Sat, Apr 25th at 3am - Sydney | Sat, Apr 25th at 2am - Tokyo | Sat, Apr 25th at 1am - Beijing | 10:30pm - Mumbai

Presented by: Brian Desmond, Laura E. Hunter

Duration: Approximately 90 minutes.

Cost: Free

WS2008 R2 Active Directory Webcast – Tomorrow, Friday 4/24

Tomorrow Laura Hunter and Brian Desmond will be doing a webcast discussing and premoting the new Active Directory features in Windows Server 2008 R2 as well as answering AD questions. They have a 90 minute slot and they expect to spend ~45-60 minutes on R2 and the remainder taking questions on the presentation and AD in general.

The webcast is hosted by O’Reilly and is free to attend. If you can’t make it, a recording will be available.

Here are the details:

Registration Link – HERE

Date: Friday, April 24, 2009

Time: 10am PT, San Francisco
6pm – London | 1pm – New York | Sat, Apr 25th at 3am – Sydney | Sat, Apr 25th at 2am – Tokyo | Sat, Apr 25th at 1am – Beijing | 10:30pm – Mumbai

Presented by: Brian Desmond, Laura E. Hunter

Duration: Approximately 90 minutes.

Cost: Free

blog: WS2008 R2 Active Directory Webcast – Tomorrow, Friday 4/24

Tomorrow Laura Hunter and Brian Desmond will be doing a webcast discussing and premoting the new Active Directory features in Windows Server 2008 R2 as well as answering AD questions. They have a 90 minute slot and they expect to spend ~45-60 minutes on R2 and the remainder taking questions on the presentation and AD in general.

The webcast is hosted by O’Reilly and is free to attend. If you can’t make it, a recording will be available.

Here are the details:

Registration Link - HERE

Date: Friday, April 24, 2009

Time: 10am PT, San Francisco 6pm - London | 1pm - New York | Sat, Apr 25th at 3am - Sydney | Sat, Apr 25th at 2am - Tokyo | Sat, Apr 25th at 1am - Beijing | 10:30pm - Mumbai

Presented by: Brian Desmond, Laura E. Hunter

Duration: Approximately 90 minutes.

Cost: Free

For those of you wondering

Windows Key Management Services (aka KMS, Volume Activation 2.0) does INDEED run on Windows 2008 Server Core. I could not find this information anywhere so I tried it and it worked ( I saw no reason why it wouldn’t.)

Perhaps Brain should use Powershell (It is taking over the world)

Just listen to a presentation on what the Cluster team is doing with R2… it is amazing.

Here is a little preview
PowerShell for Failover Clustering in Windows Server 2008 R2

The path to fixing Windows Update Service

I often need to trouble shoot Windows Update issues. I have found that some of the following things are useful to know in regards to trouble shooting:

- Review this KB How to troubleshoot common Windows Update, Microsoft Update, and Windows Server Update Services installation issues

- Try looking at WindowsUpdate.log (click for more info)

- Use wuauclt.exe tool to force the update detection
MS Page for wuauclt utility
Yet another incomplete document

- RegKeys
Create the required DWORD values from table below:
Value: NoAutoUpdate

  • 0 – Enable Automatic Updates (Default)
  • 1 – Disable Automatic Updates

Value: AUOptions

  • 2 – Notify for download and notify for install
  • 3 – Auto download and notify for install
  • 4 – Auto download and schedule the install

Value: ScheduledInstallDay

  • 0 – Install every day
  • 1 to 7 – Install on specific day of the week from Sunday (1) to Saturday (7).

Value: ScheduledInstallTime

  • 0 to 23 – Install time of day in 24-hour format

 

Note: I finally decided to run strings.exe (click for more info) against the exe and here is the list of the flags I found (you can guess what they are for:)

/DetectNow
/ReportNow
/RunHandlerComServer
/RunStoreAsComServer
/ShowSettingsDialog
/ResetAuthorization
/ResetEulas
/ShowWU
/ShowWindowsUpdate
/CloseWindowsUpdate
/SelfUpdateManaged
/SelfUpdateUnmanaged
/UpdateNow
/DemoUI

Blog post by Mark Wilson on Win 2008 R2

Mark Wilson has a great blog post on some of the features expected in Win2k8 R2. You can find it HERE.

The bestpart is (of course ;) )

On the management front: there is a greater emphasis on the command line with improved scripting capabilities with PowerShell 2 and over 200 new cmdlets for server roles as well as power, blade and chassis management – working with vendors to deliver hardware which is compatible with WS-Management – and new command line tools for migration of Active Directory, DNS, DHCP, file and print servers; Server Manager will support remote connections, with a performance counter view and best practices analyzer (similar to the ones which we have seen shipped for server products such as Exchange Server for a few years now); and a new migration portal will expose step-by-step documentation for migration of roles and operating system settings from Windows Server 2003 and 2008 servers to Windows Server 2008 R2.

The depressing part

So, when do we get to use all this Windows Server 2008 R2 goodness? Well, Microsoft is not yet ready to release a beta and, based on previous versions of Windows Server, I would expect to see at least two betas and a couple of CTPs before the release candidates – but the product team is currently not committing to a date – other than to say “early 2010″ (which, incidentally, will be 2 years after Windows Server 2008 shipped).

FREE Powershell BOOK! (er… booklet)

Not only is it free… it is actually pretty good!

http://blogs.technet.com/chitpro-de/archive/2008/02/28/free-windows-powershell-workbook-server-administration.aspx

Next »