Pages: [1]
Print
Author Topic: Virtual machine owner DL  (Read 916 times)
aflora
Newbie
*
Posts: 16


View Profile
« on: June 17, 2009, 03:47:48 PM »

Hi

Does anyone know the code to list the owner DL contacts from the summary box of a virtual machine?
« Last Edit: June 17, 2009, 06:00:42 PM by aflora » Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #1 on: June 18, 2009, 07:00:31 AM »

what do you mean owner dl?
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #2 on: June 18, 2009, 07:07:24 AM »

are you talking about extracting the info from the notes section?

if so use this:

Code:
$VMs = Get-VM
$myCol = @()

foreach($vm in $VMs){
$myObj = "" | Select-Object Name, Notes
$myObj.Name = $VM.Name
$myObj.Notes = $VM.Description
      $myCol += $myObj
}
$myCol
Logged
aflora
Newbie
*
Posts: 16


View Profile
« Reply #3 on: June 18, 2009, 07:11:17 AM »

When viewing a VM using the VIC. From the Summary tab in the annotation box there is a field named Owener DL (Distribution List).
Logged
aflora
Newbie
*
Posts: 16


View Profile
« Reply #4 on: June 18, 2009, 07:37:36 AM »

No the owner DL wasn't listed...by the way is there documentatiion on what properties and objects are available for reporting?
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #5 on: June 18, 2009, 07:56:47 AM »

sounds like a custom field that you are using, sure download the SDK API reference guide, then look in SDK\doc\ReferenceGuide\index.html then click all properties
« Last Edit: June 18, 2009, 07:59:42 AM by esarakaitis » Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #6 on: June 19, 2009, 06:20:27 AM »

so you want a list of each vm, how many drives it has, and the size of them... yes you can do that quite easily
Logged
aflora
Newbie
*
Posts: 16


View Profile
« Reply #7 on: June 24, 2009, 07:52:13 PM »

Hi esarakaitis

I finally figured out what I need to query to get the value of "Ownership DL" By using MOB(Managed Object Browser). "Ownership DL" is an availableField[9] and customValue[9] from the CustomFeildDef Data Object type. Unfortunately I'm having the darnest time trying do something useful with this inforamtion.
Would you know how to add the code to retreive this info to the folowing script?:

$Report = @()
$VMS = get-vmhost | Get-vm
   foreach ($VM in $VMS){
       $VMX = Get-View $VM.ID
       $HW = $VMX.guest.net
       foreach ($dev in $HW)
         {
             foreach ($ip in $dev.ipaddress)
             {
                    $MyDetails = "" | Select-Object Name, IP, MAC
                $MyDetails.Name = $VM.Name
                $MyDetails.IP = $ip
                $MyDetails.MAC = $dev.macaddress
                $Report +=  $MyDetails
                 }
            }
      }



Thanks!



Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #8 on: June 25, 2009, 07:28:46 AM »

the script  your referencing is to list vmname, ip and mac... and has nothing to do CustomFieldDef

why dont you post what code that you've come up with and ill help you from there

Logged
aflora
Newbie
*
Posts: 16


View Profile
« Reply #9 on: July 23, 2009, 01:34:28 PM »

It turns out that Ownership DL is a custom field. So this worked for me:

$vm =Get-VM server01
$vm.CustomFields["Ownership DL"]
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #10 on: July 24, 2009, 07:40:53 AM »

excellent, how did you finally find it?
Logged
aflora
Newbie
*
Posts: 16


View Profile
« Reply #11 on: August 25, 2009, 05:10:09 PM »

First I found it by browsing through my infrastructure using the MOB.

Then LucD of the PowerCLI forum helped me with the code.

 

$vm.CustomFileds["Ownership DL"]

 

I didn't realize the code for this was that easy. I was including the full path from the MOB in my code.

 

something like this:

 

$vm.AvailableField.value.CustomFields["Ownership DL"]

 

DOH!

Logged
Pages: [1]
Print
Jump to: