Sureshadmin's Posts

Thanks Luc. In the webaccess frontpage if VMware displays the FQDN of the ESX box that would be so good.
Thanks for your effort Robert. But unfortunately as i mentioned earlier dont know the VC details. The scenario is there are many esx boxes in many domains and there were many license purcha... See more...
Thanks for your effort Robert. But unfortunately as i mentioned earlier dont know the VC details. The scenario is there are many esx boxes in many domains and there were many license purchased from VMware and used. Now lost track of license usage and have to tally it. Tracked 27000 port and got all IP address and want to find ESX FQDN.
Hi Luc, nslookup fails. Looks like the ESX SC IP belong to different domain which is trusted to the domain which i'm logged in. Any other way, pls suggest.
Hi, I have a list of service console IP's of ESX servers but dont know their FQDN, dont know their VC details and dont know their credential details. But i can ping the SC IP and able to open ... See more...
Hi, I have a list of service console IP's of ESX servers but dont know their FQDN, dont know their VC details and dont know their credential details. But i can ping the SC IP and able to open the webaccess page using SC IP. Is there a way to find FQDN of the ESX box using the IP. Please note ping -a (or) nbtstat -A do not work.
Thanks Robert. This works perfect. Any idea how to make 2 collapsible panel in a single webpage? for example: vmlist of 2 clusters, each in a separate collapsible panel.
Hi, I have a basic HTML/Javascript code to produce a collapsible panel in HTML page. I want a powershell script which can process this peice of HTML code and output the result of Get-cluster "... See more...
Hi, I have a basic HTML/Javascript code to produce a collapsible panel in HTML page. I want a powershell script which can process this peice of HTML code and output the result of Get-cluster "mycluster" | Get-VM inside the collapsible panel. <html>   <head>   <title>Test page</title>   </head>   <body> <script language="javascript"> var ie4 = false; if(document.all) { ie4 = true; } function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } } function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId); if (lText == '+') { link.innerHTML = '−'; d.style.display = 'block'; } else { link.innerHTML = '+'; d.style.display = 'none'; } } </script> <div style="border: 1px solid #000000; padding: 0px; background: #EEEEEE; "><table border="0" cellspacing="0" cellpadding="2" width="100%" style="background: #000000; color: #FFFFFF; "><tr><td>Testbox</td><td align="right"> [<a title="show/hide" id="exp1306866434_link" href="javascript: void(0);" onclick="toggle(this, 'exp1306866434');"  style="text-decoration: none; color: #FFFFFF; ">−</a>]</td></tr></table> <div id="exp1306866434" style="padding: 3px;">Powershell content goes here</div> <script language="javascript">toggle(getObject('exp1306866434_link'), 'exp1306866434');</script>   </body> </html> Thanks in advance!
From the powercli book functions,  there is function delete-harddisk in chapter 7. How to use this function to delete harddisk (vmdk) files directly from the datastore ie.. A vmdk which is not co... See more...
From the powercli book functions,  there is function delete-harddisk in chapter 7. How to use this function to delete harddisk (vmdk) files directly from the datastore ie.. A vmdk which is not connected to any of the vm and orphaned in datastore. I have a csv file which has the full path to the vmdk's like [dstore1] abc/abc.vmdk. Want to use this function to delete those vmdk's from datastore. I see reconfigVm_task is used in the function to execute this function with a vm, is there a way to alter the function and enable it to delete the orphaned vmdk directly from datastore
Luc, At Last when export the report to CSV file, the vaules of $totalsize and $totalusize does not get copied in csv sheet. How do i export the values of $totalsize and $totalusize at the end... See more...
Luc, At Last when export the report to CSV file, the vaules of $totalsize and $totalusize does not get copied in csv sheet. How do i export the values of $totalsize and $totalusize at the end of the CSV File? ......... @{N="Used%";E={"{0:P1}" -f $usedPerc}},     @{N="Mount point";E={$_.Path}}     $totalsize += ($totalsize + $sizeGB)     $totalusize += ($totalusize + $usedGB)     }   $totalsize   $totalusize } | Export-csv "c:\test.csv" }
You are absolutely right . I was importing roles in a new environment where i had only Virtual center app installed and others were missing. So privileges related to missing components produce... See more...
You are absolutely right . I was importing roles in a new environment where i had only Virtual center app installed and others were missing. So privileges related to missing components produces the error when tried to import them in a role.
Luc, 1. I tried the simple testrole with the script and worked fine. 2. i tried to export the roles with your latest script and tried to import it . Some roles got imported others were not.... See more...
Luc, 1. I tried the simple testrole with the script and worked fine. 2. i tried to export the roles with your latest script and tried to import it . Some roles got imported others were not. 3. So came to a conclusion there should be something wrong with handling some permissions. Can you please try to create a role with below given permissions and test whether are you able to create? for me it fails.   <Privilege Name="Global.com.vmware.Global.CapacityIQ" />   <Privilege Name="VcIntegrity.Baseline.com.vmware.vcIntegrity.AssignBaselines" />   <Privilege Name="VcIntegrity.Baseline.com.vmware.vcIntegrity.ManageBaselines" />   <Privilege Name="VcIntegrity.General.com.vmware.vcIntegrity.Configure" />   <Privilege Name="VcIntegrity.Updates.com.vmware.vcIntegrity.Remediate" />   <Privilege Name="VcIntegrity.Updates.com.vmware.vcIntegrity.Scan" />   <Privilege Name="VcIntegrity.Updates.com.vmware.vcIntegrity.ViewStatus" />  
Luc, I have scaled down your script for Import / export of only roles in Virtual center and left out the permission part. I can export the roles without any problem. But while importing i face... See more...
Luc, I have scaled down your script for Import / export of only roles in Virtual center and left out the permission part. I can export the roles without any problem. But while importing i face a error. can you please help me in troubleshooting. Both the script i use and error are given below, function New-Role {     param($name, $privIds)     Begin{}     Process{         $roleId = $authMgr.AddAuthorizationRole($name,$privIds)     }     End{         return $roleId     } } # Create hash table with the current roles $authMgr = Get-View AuthorizationManager $roleHash = @{} $authMgr.RoleList | % {     $roleHash[$_.Name] = $_.RoleId } # Read XML file $XMLfile = “C:\role.xml” $vInventory =[xml]“<dummy/>” $vInventory.Load($XMLfile) # Define Xpaths for the roles and the permissions $XpathRoles = “Inventory/Roles/Role” # Create custom roles $vInventory.SelectNodes($XpathRoles) | % {     if(-not $roleHash.ContainsKey($_.Name)){         $privArray = @()         $_.Privilege | % {             $privArray += $_.Name         }         $roleHash[$_.Name] = (New-Role $_.Name $privArray)     } } Error, Exception calling "AddAuthorizationRole" with "2" argument(s): "vim.fault.NotFound" At :line:8 char:47 + $roleId = $authMgr.AddAuthorizationRole <<<< ($name,$privIds) Additionally i have tried to alter the lines as given below, but does not work and throws the error, [xml]$vInventory = “<dummy/>” [xml]$vInventory.Load($XMLfile)
Thanks Luc. It works!
Hi Luc, In my environment there is a known problem that a couple of datastore had VMFS crash and none of the esx box could read the contents of datastore. I'm running this script Get-orphaned-... See more...
Hi Luc, In my environment there is a known problem that a couple of datastore had VMFS crash and none of the esx box could read the contents of datastore. I'm running this script Get-orphaned-vmdk and when this script tries to retrive the contents of the corrupted datastore in the line $dsBrowser.SearchDatastoreSubFolders($rootPath, $searchSpec) the script breaks and halts. Could you please help to skip the datastore where it can't get the contents and continue with remaining datastores?
hi Luc, In the below given script i'm trying to retrive the datastore usage from each cluster by querying the first host of the cluster. The script runs fine. But at last row for each cluster ... See more...
hi Luc, In the below given script i'm trying to retrive the datastore usage from each cluster by querying the first host of the cluster. The script runs fine. But at last row for each cluster i want a line with total capacity and total used capacity. But since there are hundreds of LUN's for each cluster the total value is so big and so it doesnt not get stored into the variable in proper format. What type of variable do i declare $totalsize and $totalusize as? $dsTab = @{} $clusters = Get-Cluster foreach  ($cluster in $clusters) { $vmhosts = $cluster | Get-VMHost $fhost = $vmhosts[0] $esxImpl = $fhost $ds = $esxImpl | Get-Datastore | %{$dsTab[$_.Name] = $_} $esxImpl | Get-VMHostStorage | %{   $_.FileSystemVolumeInfo | %{    $sizeGB = $_.Capacity/1GB    $usedGB = ($_.Capacity/1MB - ($dsTab[$_.Name]).FreeSpaceMB)/1KB    $usedPerc = $usedGB / $sizeGB    $availGB = ($dsTab[$_.Name]).FreeSpaceMB/1KB    $ds = Get-View $dsTab[$_.Name].Id    $_ | select @{N="ESX Name";E={$esxImpl.Name}},     @{N="Cluster Name";E={$cluster}},     @{N="FS Name";E={$_.Name}},     @{N="Type";E={$_.Type}},     @{N="SizeGB";E={"{0:N1}" -f $sizeGB}},     @{N="UsedGB";E={"{0:N1}" -f $usedGB}},     @{N="AvailableGB";E={"{0:N1}" -f $availGB}},     @{N="Used%";E={"{0:P1}" -f $usedPerc}},     @{N="Mount point";E={$_.Path}}     $totalsize += ($totalsize + $sizeGB)     $totalusize += ($totalusize + $usedGB)     }   $totalsize   $totalusize } }
Luc, I have tried with plink and i'm able to login to the esx box, even the host key fingerprint is also present. But still the script runs for sometime but it doesn't show a error or a output... See more...
Luc, I have tried with plink and i'm able to login to the esx box, even the host key fingerprint is also present. But still the script runs for sometime but it doesn't show a error or a output. I'm running this against ESX 3.5 box. Can you pls look into it?
Hi Robert, Is it possible to collect the version of HP SIM agent version on ESX 3.5 using "Numericsensorinfo"?
Perfect, it works!   Thanks a Ton!  
Luc, Now it reconfigures 10 VM's and gives out this error. Can you please have a look? As the tasks complete it does not not pick up other machines in the cluster for reconfiguration An ... See more...
Luc, Now it reconfigures 10 VM's and gives out this error. Can you please have a look? As the tasks complete it does not not pick up other machines in the cluster for reconfiguration An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not execute.. At :line:14 char:7 + foreach <<<< ($task in $taskHash.Values){ Message was edited by: Sureshadmin Message was edited by: Sureshadmin
Luc, Again it configures for one VM and gives out this error, Array assignment to [task-134165] failed: Cannot convert value "task-134165" to type "System.Int32". Error: "Input string was ... See more...
Luc, Again it configures for one VM and gives out this error, Array assignment to [task-134165] failed: Cannot convert value "task-134165" to type "System.Int32". Error: "Input string was not in a correct format.". At :line:12 char:10 + $taskHash[ <<<< $task.Info.Key] = $task
Hi Luc, It reconfigures one machine in the cluster and then gives out the error, Cannot bind parameter 'Id'. Cannot convert the "VMware.Vim.Task" value of type "VMware.Vim.Task" to type ... See more...
Hi Luc, It reconfigures one machine in the cluster and then gives out the error, Cannot bind parameter 'Id'. Cannot convert the "VMware.Vim.Task" value of type "VMware.Vim.Task" to type "VMware.Vim.ManagedObjectReference". At :line:12 char:18 + $task = Get-View <<<< (Get-View($_.Extensiondata.ReconfigVM_Task($spec)))