Welcome to MSDN Blogs Sign in | Join | Help

Querying guest operating system information with Powershell

I recently posted how to query guest operating system information using VBScript.  It was pointed out to me that this was much easier to do using Powershell, so here is a sample script that will do the same thing with Powershell:

$vs=new-object –com VirtualServer.Application –Strict
$result = SetSecurity($vs)
$vm = $vs.FindVirtualMachine("Windows Server")
$result = SetSecurity($vm)
$guestOS = $vm.GuestOS
$result = setSecurity($guestOS)
$guestOS

Of course in order for this to work you need to have your Powershell environment setup as detailed in this post and this post.

When run this will provide output that looks like:

IsHostTimeSyncEnabled : True
HeartbeatPercentage   : 100
IsHeartbeating        : True
OSName                : Windows ServerT 2003, Enterprise Edition Service Pack 1
AdditionsVersion      : 13.709
CanShutdown           : True

As it will list all of the properties of the object and their current values.

Cheers,
Ben

Published Tuesday, January 30, 2007 12:07 AM by Virtual PC Guy

Comments

Saturday, February 03, 2007 12:41 PM by VMblog.com - Virtualization Information

# Microsoft Virtual Server and PowerShell

If you haven't already checked it out, be sure to jump over to Ben Armstrong's blog site, Virtual PC

Tuesday, July 24, 2007 5:55 AM by Fredrik Wall [Mycket skript blir det]

# Intressanta PowerShell postningar (länkar)

När man som jag håller på med PowerShell välldigt, välldigt mycket så hamnar man ofta på många olika...

New Comments to this post are disabled
 
Page view tracker