amarcy's Posts

Figured it out, I was missing the Guest.HostName property when defining parameters of get-view: Get-View -ViewType VirtualMachine -Property Name, Guest.HostName
Sorry for the late reply.  I understand that $_.Guest.Hostname returns the VM machine name.  My problem is that the query is returning nothing in the second part of my select statement.  The firs... See more...
Sorry for the late reply.  I understand that $_.Guest.Hostname returns the VM machine name.  My problem is that the query is returning nothing in the second part of my select statement.  The first column should return the VM name, and the second column should return the VM machine name.  I don't know why it's not returning the latter.  And just to clarify, I'm not interested in the ESXi host name.  Thanks.
Can anyone tell me why this one liner only returns the VM name and not the Guest Host name? Get-View -ViewType VirtualMachine -Property Name -Filter @{"Guest.HostName" = ".*$prompt.*"} | Selec... See more...
Can anyone tell me why this one liner only returns the VM name and not the Guest Host name? Get-View -ViewType VirtualMachine -Property Name -Filter @{"Guest.HostName" = ".*$prompt.*"} | Select @{N='VM Name';E={$_.Name}}, @{N='Guest Host Name';E={$_.Guest.HostName}} | ft -wrap -auto Thanks!
Gah...I should have figured it would be that simple.  Thanks for setting me straight.
THanks LucD, that works.  I was doing it a more manual way because I wanted to display the header even if no data was returned.  I suppose I could setup an if statement so if there are no results... See more...
THanks LucD, that works.  I was doing it a more manual way because I wanted to display the header even if no data was returned.  I suppose I could setup an if statement so if there are no results, return the header with a message about 0 results.  Curious though, any idea why my original script wasn't returning any results?  It would return 5 blank rows with the header in the email.
Hi everyone, I'm having some trouble pushing array results into an object, and then adding the object's members to an array.  I've had success using the below method in the past, but I've only... See more...
Hi everyone, I'm having some trouble pushing array results into an object, and then adding the object's members to an array.  I've had success using the below method in the past, but I've only (previously) tried it with one cmdlet.  In the example below, I am piping multiple cmdlets.  Basically, $vms outputs fine, but I can't get any of the instantiated arrays to populate thereafter.  The $mainArray always outputs as null in the email.  Any ideas?  I really don't want to put get-vievent in the foreach loop as it will really slow down the query. Connect-viserver test.testdomain.com $mainArray = @() $userArray = @() $timeArray = @() $msgArray = @() $CDT = Get-Date $vms = Get-VM | Get-VIEvent -Types Info -Start $CDT.AddDays(-30) -Finish $CDT | Where { $_.Gettype().Name -eq "VmBeingDeployedEvent" -or $_.Gettype().Name -eq "VmCreatedEvent" -or $_.Gettype().Name -eq "VmRegisteredEvent"} | Select UserName, CreatedTime, FullFormattedMessage | Format-Table -AutoSize foreach ($vm in $vms) {    $username = $vm.UserName    $createdTime = $vm.CreatedTime    $msg = $vm.FullFormattedMessage       $userArray += $username   $timeArray += $createdTime   $msgArray += $msg }    For($i=0;$i -lt $userArray.Count;$i++)   {   $item = New-Object PSObject   $item | Add-Member -type NoteProperty -Name 'UserName' -Value $userArray[$i]   $item | Add-Member -type NoteProperty -Name 'Created Time' -Value $timeArray[$i]   $item | Add-Member -type NoteProperty -Name 'Message' -Value $msgArray[$i]   $mainArray += $item     } $Head = @" <style> TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;} TH {border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color: #6495ED;} TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;} </style> "@ #####begin send email section#### $comp = get-wmiobject win32_computersystem $mailFrom = $comp.name $FromAddr = $mailFrom + "@testdomain.com" $ToAddr = "testuser@testdomain.com" $Subject = "VMs created over last 30 days" $SMTPServer = "smtp.testdomain.com" $Body = $mainArray |  ConvertTo-Html -head $Head | Out-String Send-MailMessage -from $FromAddr -To $toAddr -Subject $Subject -Body ($body) -BodyasHtml -SmtpServer $SMTPServer disconnect-viserver -confirm:$false
Finally figured this out.  I first had to wrap my head around the idea that LDAP is defined not only at the top VCD level, but also at the Organizational level.  When I had initially setup the or... See more...
Finally figured this out.  I first had to wrap my head around the idea that LDAP is defined not only at the top VCD level, but also at the Organizational level.  When I had initially setup the organization, I had defined a OU (ou=users) which was not how I had intended to set it up.  To change this, have to login to the VCD URL (https://<FQDN>/cloud), click on manage & monitor, click organizations (top), then right click the organization listed and select properties.  There is a tab to configure LDAP.  It's probably best to select "custom" if you want to define LDAP users specifically for this organization. Frankly, it's a little difficult to find some of the configuration areas in VCD.  A lot of the LDAP config looks the same in the documentation.  In any event, this is the solution in case anyone runs into this problem.
I still haven't found a solution, but I think the problem has to do with AD groups not being recognized correctly.  In our AD environment, we are using simple authentication and don't use SSL.  W... See more...
I still haven't found a solution, but I think the problem has to do with AD groups not being recognized correctly.  In our AD environment, we are using simple authentication and don't use SSL.  When I log into VCD at the root level, I am able to add AD users/groups; when I log in to VCD at the organizational level, I can only add groups but can't add users.  FWIW, I'm logging in with a system administrator account. Again, I get the following error message when trying to import AD groups at the organizational level:  "error searching in a groups or users identity source." Can anyone tell me what this error means?
Sorry to bump my own thread, but has anyone encountered this error message?
Hello, I am a bit new to VCD so please pardon my ignorance.  I'm working in a test lab w/ a full install of VCD (5.1) and CentOS 6.3.  My problem is that while I am able to import users into VCD ... See more...
Hello, I am a bit new to VCD so please pardon my ignorance.  I'm working in a test lab w/ a full install of VCD (5.1) and CentOS 6.3.  My problem is that while I am able to import users into VCD at the "<FQDN>/cloud" level, I cannot import users at the organizational "<FQDN>/cloud/org/orgname" level.  I get the following error:  "error searching in a groups or users identity source."  Oddly enough, I can add an AD group, but I still can't login with that user so that it may create/add the user account for me.  Perhaps I'm misunderstanding how users/groups works in VCD? Any help is appreciated. I can provide log files if necessary.  Thanks.
I too am encountering a similar problem when trying to upgrade vcenter server from 5.0 to 5.1.  I have vcenter, inventory, and SSO broken out onto separate hosts.  Inventory and SSO were fresh in... See more...
I too am encountering a similar problem when trying to upgrade vcenter server from 5.0 to 5.1.  I have vcenter, inventory, and SSO broken out onto separate hosts.  Inventory and SSO were fresh installs of 5.1, so all I need is a way to be able to upgrade vcenter server from 5.0 to 5.1.  However, everytime i try to run the installer it prompts with a message that there is an old version of Inventory installed (which there is, 5.0).  Is there a registery tweak that allows me to point to my new 5.1 Inventory?  I just want to bypass this message so I can continue upgrading vcenter server to 5.1. I did try upgrading Inventory to 5.1 then uninstalling it like craigj405 suggests.  That works, but it seems like a rather crude solution...I can't imagine that this would be considered a VMware best practice. Anybody have a better workaround?