Biyouk's Posts

Log on the ESXi host and access this path /etc/vmware/hostd/vmInventory.xml Rename the VMInventory.xml file and restart /etc/init.d/hostd restart
Thanks for your help. It's works.
LittleNickey LittleNickey Thanks for your answer. The first solution works but like you mention the output is messy. For the second solution, same if I remove the array, i was not able to se... See more...
LittleNickey LittleNickey Thanks for your answer. The first solution works but like you mention the output is messy. For the second solution, same if I remove the array, i was not able to see the result in the email.
Hi Everyone, Can someone provide me help with this example. I'm starting to work with PowerCLI and I have difficulty to output my result in an email. How can I store my result in array and ... See more...
Hi Everyone, Can someone provide me help with this example. I'm starting to work with PowerCLI and I have difficulty to output my result in an email. How can I store my result in array and import the data in HTML in an email ? From the example below, I don't see any result in the email from the powercli command " Get-VM | Select-Object Name, NumCPU, MemoryMB, ProvisionedSpaceGB" Do I need to create a loop to extract the result ? #-------------------------CHANGE THESE VALUES-------------------------------- $SMTPServer = "SMTP.toto.com" $vCenterServerName1 = "vsphere1.toto.com" $ToAddress = lady@toto.com #----------------------------------------------------------------------------- $Title = "Connection settings for vCenter" $Author = "Lady" $Header =  "Connection Settings" $Login = account@toto.com# for LAFAM domain $Password = "xxxxxxxxxx# add-pssnapin VMware.VimAutomation.Core $HTMLHeader = "<HTML><TITLE> VMware report </TITLE>" $HTMLFooter = "Made with POWERSHELL Script 2.0 - Version of the script " + $ScriptVersion + "</HTML>" $ScriptVersion = "v1.0" $Subject = "VMware Report - VM Inventory " $FromAddress = "VMware" + "@toto.com" $ColorArray = "Red", "Orange", "Purple", "Blue", "Olive", "SlateGrey", "Orange", "Purple", "Blue", "Olive" $ColorArrayIndex = 0 $HTMLHeader = "<HTML><TITLE> VMware Report for " + $vCenterServerName1 " </TITLE>" $HTMLFooter = "Made with POWERCLI Script 5.0 - " +  $Author + ".<br><br>" $HTMLFooter += "<B>NOTE:</B> $Date </HTML>" $HTMLBody = "<BODY>" $vCenter_inventory = @(Get-VM | Select-Object Name, NumCPU, MemoryMB, ProvisionedSpaceGB) ################################### OUTPUT ####################################### # HEADER $HTMLBody += CreateHeader ("REPORT FOR <font color=Blue><b> vCENTER " + $vCenterServerName1 + "</font></b><br>") # INTRO TEXT $HTMLBody += "<br><br>" $HTMLBody += $vCenter_inventory ########################### SEND REPORT BY E-MAIL ################################# $HTMLBody += "</BODY>" # Close HTML Body $HTMLPage = $HTMLHeader + $HTMLBody + $HTMLFooter Send-Mailmessage -From $FromAddress -To $ToAddress -Subject $Subject -BodyAsHTML -Body $HTMLPage -Priority Normal -SmtpServer $SMTPServer Write-Host "Report has been sent by E-mail to " $ToAddress " from " $FromAddress ################################### CLEANUP ####################################### $HTMLHeader = "" $HTMLBody = "" $HTMLFooter = "" $HTMLPage = "" $vCenter1_Inventory = "" $vCenterServerName1 = ""
I ran to a similar issue in the past. You need to make sure the RDM is presented to each ESXi host with the same LUN ID number.
LUC Thanks for your example. This works properly. Attachment is txt file, I  use notepad. If I want to copy the contain of $Filename under the body of the mail, how can I process ? I tried t... See more...
LUC Thanks for your example. This works properly. Attachment is txt file, I  use notepad. If I want to copy the contain of $Filename under the body of the mail, how can I process ? I tried to use the parameter -body or -bodyAsHtml I got an error message Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified method is not supported. At D:\support\Scripts\Resource_Pool_amavcs01\Test.ps1:225 char:17 + Send-MailMessage <<<<  -From $EmailFrom -To $EmailTo -Subject $EmailSubject -SmtpServer $SMTPSRV -BodyAsHtml $MyReport -Attachments $Filename1     + CategoryInfo          : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException     + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SendMailMessage $MyReport = (get-content $Filename) # To format properly the contains of Transcript to readable notepad document [string]::Join("`r`n",(Get-Content $Filename)) | Out-File $Filename $MyReport = (get-content $Filename) Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $EmailSubject -SmtpServer $SMTPSRV -BodyAsHtml $MyReport -Attachments $Filename1 JEFF
LUC Thanks for your example. This works properly. Attachment is txt file, I use notepad. If I want to copy the contain of $Filename under the body of the mail, how can I process ? I tried t... See more...
LUC Thanks for your example. This works properly. Attachment is txt file, I use notepad. If I want to copy the contain of $Filename under the body of the mail, how can I process ? I tried to use the parameter -body or -bodyAsHtml I got an error message Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified method is not supported. At D:\support\Scripts\Resource_Pool_amavcs01\Test.ps1:225 char:17 + Send-MailMessage <<<< -From $EmailFrom -To $EmailTo -Subject $EmailSubject -SmtpServer $SMTPSRV -BodyAsHtml $MyReport -Attachments $Filename1 + CategoryInfo : InvalidArgument: ( , ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SendMailMessage $MyReport = (get-content $Filename) To format properly the contains of Transcript to readable notepad document ::Join("`r`n",(Get-Content $Filename)) | Out-File $Filename $MyReport = (get-content $Filename) Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $EmailSubject -SmtpServer $SMTPSRV -BodyAsHtml $MyReport -Attachments $Filename1 JEFF
Thanks Luc Need more information if you can. I'm reading in a variable $MyReport the output file which was created by "start/stop -transcript" and send it to email. $MyReport = (get-content... See more...
Thanks Luc Need more information if you can. I'm reading in a variable $MyReport the output file which was created by "start/stop -transcript" and send it to email. $MyReport = (get-content $Filename) $mailer = new-object Net.mail.SMTPclient($SMTPSRV) $msg = new-object Net.mail.MailMessage($EmailFrom, $EmailTo, $EmailSubject, $MyReport) $msg.IsBodyHTML = $true $mailer.send($msg) Could you explain me how integrate your command to convert $Myreport with CR-LF sequence ?
Hi I created a script and used the command Start-Transcript / Stop transcript to generate an output file. I send the output file by email but the formatting is ugly. I'm beginner in Powershel... See more...
Hi I created a script and used the command Start-Transcript / Stop transcript to generate an output file. I send the output file by email but the formatting is ugly. I'm beginner in Powershell / PowerCLI. Could you provide me any tips how to produce a good report on an email. Ex : ********************** Windows PowerShell Transcript Start Start time: 20121220165023 Username : xxxxxxxxxMachine      : xxxxxxxx (Microsoft Windows NT 6.1.7600.0) ********************** Transcript started, output file is D:\support\Scripts\Resource_Pool_xxxxxxx\Report.csv *** Resource Pool information of 1_OVC01_GOLD : *** Current CPU Shared = 2000 Current Memory Shared = 2000 Current number of Powered On VM Guest in this resource pool: 5 The new number of CPU and Memory Shared for this Pool is = 2000 The values of this resource pool doesn't need to be updated *** Resource Pool information of 2_OVC01_SILVER : *** Current CPU Shared = 1400 Current Memory Shared = 1400 Current number of Powered On VM Guest in this resource pool: 7 The new number of CPU and Memory Shared for this Pool is = 1400 The values of this resource pool doesn't need to be updated *** Resource Pool information of 3_OVC01_BRONZE : *** Current CPU Shared = 300 Current Memory Shared = 300 Current number of Powered On VM Guest in this resource pool: 3 The new number of CPU and Memory Shared for this Pool is = 300 The values of this resource pool doesn't need to be updated *** Resource Pool information of 1_VCS01_GOLD : *** Current CPU Shared = 18000 Current Memory Shared = 18000 Current number of Powered On VM Guest in this resource pool: 45 The new number of CPU and Memory Shared for this Pool is = 18000 The values of this resource pool doesn't need to be updated *** Resource Pool information of 2_VSC01_SILVER : *** Current CPU Shared = 6800 Current Memory Shared = 6800 Current number of Powered On VM Guest in this resource pool: 34 The new number of CPU and Memory Shared for this Pool is = 6800 The values of this resource pool doesn't need to be updated *** Resource Pool information of 3_VSC01_BRONZE : *** Current CPU Shared = 3200 Current Memory Shared = 3200 Current number of Powered On VM Guest in this resource pool: 32 The new number of CPU and Memory Shared for this Pool is = 3200 The values of this resource pool doesn't need to be updated *** Resource Pool information of 1_VCS02_GOLD : *** Current CPU Shared = 16000 Current Memory Shared = 16000 Current number of Powered On VM Guest in this resource pool: 40 The new number of CPU and Memory Shared for this Pool is = 16000 The values of this resource pool doesn't need to be updated *** Resource Pool information of 2_VSC01_SILVER : *** Current CPU Shared = 6400 Current Memory Shared = 6400 Current number of Powered On VM Guest in this resource pool: 32 The new number of CPU and Memory Shared for this Pool is = 6400 The values of this resource pool doesn't need to be updated *** Resource Pool information of 3_VCS02_BRONZE : *** Current CPU Shared = 3100 Current Memory Shared = 3100 Current number of Powered On VM Guest in this resource pool: 31 The new number of CPU and Memory Shared for this Pool is = 3100 The values of this resource pool doesn't need to be updated ********************** Windows PowerShell Transcript End End time: 20121220165027 ********************** Thanks
Thanks for your example. You help me a lot.
Hi Everyone I'm trying to understand why I have these differences below: 1) When I ran this command from PowerCLI console "Get-ResourcePool 1_OVC01_GOLD". The result is : Name         ... See more...
Hi Everyone I'm trying to understand why I have these differences below: 1) When I ran this command from PowerCLI console "Get-ResourcePool 1_OVC01_GOLD". The result is : Name                 Id ----                 -- 1_OVC01_GOLD         ResourcePool-resgroup-3603 2) When I ran the same command from a PS1 PowerShell Script, the result is different : ParentId                 : ResourcePool-resgroup-411 Parent                   : Resources CpuSharesLevel           : Custom NumCpuShares             : 2000 CpuReservationMHz        : 0 CpuExpandableReservation : True CpuLimitMHz              : -1 MemSharesLevel           : Custom NumMemShares             : 2000 MemReservationMB         : 1045 MemExpandableReservation : True MemLimitMB               : -1 Name                     : 1_OVC01_GOLD CustomFields             : {} ExtensionData            : VMware.Vim.ResourcePool Id                       : ResourcePool-resgroup-3603 Uid                      : /VIServer=serv_vcadmin@am.lafargeone.net@amavcs01.am.lafargeone.net:443/ResourcePool=ResourcePool-resgroup-3603/ 3) I would like to extract the values of NumCpuShares and NumMemShares on some output but the following comment doesn't work. Can someone explain me why ? Get-ResourcePool 1_OVC01_GOLD | Select-String -pattern "NumCpuShares" Get-ResourcePool 1_OVC01_GOLD | Select-String -pattern "NumMemShares" Thanks for your help. JEFF
Hi Everyone I'm working for a company which has several small offices. These small office requires small virtualized solution. To reduce cost, I'm wondering if we can eliminate the backup loca... See more...
Hi Everyone I'm working for a company which has several small offices. These small office requires small virtualized solution. To reduce cost, I'm wondering if we can eliminate the backup locally by enabling Vmware Replication Manager between the local site and our main Data Center. I would like to perform the  backup of the vmdk files directly in the IDC using EMC AVAMAR. This solution can't work without using PowerCLI and I would like to have feedback from PowerCLI Expert. The replica of the vmdk files in the main Data Center won't be registered in VCenter and EMC Avamar won't be able to perform image level backup of the VM guests. I'm wondering if this algorithm below will work and if it's possible to use Power CLI and Replication Manager to perform the backup : 1) Disable Replication Manager 2) Register the VM guest to VCenter 3) Backup these VM guests Using EMC Avamar 4) Remove the VM Guest from Inventory in VCenter 5) re-enable Replication Manager I appreciate any feedback
Hi Everyone I'm working for a company which has several small offices. These small office requires small virtualized solution. To reduce cost, I'm wondering if we can eliminate the backup loca... See more...
Hi Everyone I'm working for a company which has several small offices. These small office requires small virtualized solution. To reduce cost, I'm wondering if we can eliminate the backup locally by enabling Vmware Replication Manager between the local site and our main Data Center. I would like to perform the  backup of the vmdk files directly in the IDC using EMC AVAMAR. This solution can't work without using PowerCLI and I would like to have feedback from PowerCLI Expert. The replica of the vmdk files in the main Data Center won't be registered in VCenter and EMC Avamar won't be able to perform image level backup of the VM guests. I'm wondering if this algorithm below will work and if it's possible to use Power CLI to perform these steps : 1) Disable Replication Manager 2) Register the VM guest to VCenter 3) Backup these VM guests Using EMC Avamar 4) Remove the VM Guest from Inventory in VCenter 5) re-enable Replication Manager I appreciate any feedback JFN
Hi Everyone I'm starting to create some script in PowerCLI, I would like to update automatically the shared value of CPU and memory of each resource pool I have in my VCenter. I need to know... See more...
Hi Everyone I'm starting to create some script in PowerCLI, I would like to update automatically the shared value of CPU and memory of each resource pool I have in my VCenter. I need to know the vlaue of the CPUshard and MemShares and I don't know how to get the value. I put some print screen if it's not clear. Hoe I can extract the value of the custom shared of CPU and Memory Thanks for your help.