Welcome to my Notes!

Hello Folks, I would like to introduce myself as Gautam Johar and learner of VMware's technologies but not limited to. I am part of ma...

Sunday, 20 September 2020

vROPS | Cannot share dashboard with my account

Hello Folks,

However, today's post is giving solution for one issue but it will open up your mind to hunt for solution of many issues. If not then it will help you to understand roles and permission of vROPS with realtime example.

So, story is like, I was working on vRops and noticed that I couldn't share my dashboard which I created with my domain account. Hope you know how to share any dashboard created in vROPS. If not then refer to below image. Click on highlighted icon to share any dashboard.


But, I was not getting this icon. Refer to below image. Do you see any icon here? Of course not.


Now, let's hunt for solution. It is clear that if you don't see any functionality in any application then it can be due to two reasons

1. An application bug
2. Less or no access permissions

First point is ruled out because, I cross checked with admin account that I could see this option with admin account.

If not first then it is second point which is causing the issue here. Now, question is how to resolve it.

Here you go...

Question 1 - What is your user account name?

In my case, it is holadmin. I used VMware HOL to demonstrate this time ;)

Question 2 - This user is part of which "User groups"?

To check this, navigate as shown in below image


So, now we know that my user account that is "holadmin" is part of two groups that are "Everyone" and "HOL Admin Group".

Question 3 - What roles are assigned to these groups?

I would check in "HOL Admin Group" because "Everyone" group is default one. Want to know, how to check? follow below steps-


Now, as you can see in above pic that group "HOL Admin Group" has "Administrator" role. What Next?

Question 4 - This "Administrator" roles has which permissions?

Let's explore it further with below image.


To see all permission, you can check the permission column and to modify, click on EDIT.


Hope you can see that check boxes, Share(internal) and Share (public) are unchecked. This is the reason, I couldn't see the share icon because share dashboard permission was not granted to this group.

Share(Internal) - dashboard can be shared between the users who are part of this group only.

Share(Public) - dashboard can be shared between all the users who are part of any group in vrops.

Check both option (or one, as per your wish) and click on update.

That's it. After update, you will see the share icon as I shown above in very first image.

This was just an example but if you understand it then you will be able to resolve many such issues.

Hope it was useful!

Any thoughts, any comments are welcome!


Thank you,
Gautam Johar






Monday, 14 September 2020

vROPS | how to check manually uploaded PAK file status

 Hello Guys,

VMware has this process mentioned but that is confusing to me and I had to deal it differently to make it happen. So, I thought to write down on my blog. I hope it will help many. Its again amazing that this process is not included in vROPS API guide.

Basically, after manually upload the PAK file or you can say that after pre-staging of PAK file, we need to ensure now that we did it right so we have to use this API way to check that.

Step 1 : Connect vROPS in API as per instructions in vROPS API guide

Step 2 : Again, as per instructions in api guide, use vrops auth token and basic authentication now.  

Step 3 : This step, I didn't find anywhere in API guide. You need to modify the command as shown below with GET operation and then hit the search button.

https://myvrops.com:443/casa/upgrade/cluster/pak/vRealizeOperationsManagerEnterprise-81116522883/status

vRealizeOperationsManagerEnterprise-81116522883 > This is the PAK file ID of PAK file which I uploaded manually and want to check if distributed across the cluster or not. 

Once I hit the go button, it give me below output.

=======Start here

{

    "cluster_pak_install_status": "CANDIDATE",

   "slices": [

        {

            "slice_address": "172.25.10.11", >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node 1

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> It is Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "UNKNOWN",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.25.10.12",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node 2

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> it is again Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "UNKNOWN",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

           },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.25.2.238",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node3

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": null,

                "orchestrator_action": "UNKNOWN",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.17.1.238",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node4

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "NO_ACTION",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.17.1.239",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node5

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "NO_ACTION",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.25.3.238",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node 6

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "UNKNOWN",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.17.1.237",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node 7

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "NOT_DISTRIBUTED>>>>>>>>>>>>>>>Here is the difference but still OK

                "pak_install_status": "INITIAL",

                "pak_distribution_progress": "6962",

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "NO_ACTION",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.17.1.248",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Host8

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": "upgrade.pak.warning",

                "orchestrator_action": "NO_ACTION",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.25.3.237",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node 9

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": null,

                "orchestrator_action": "UNKNOWN",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        },

        {

            "slice_address": "172.25.1.244",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Node 10

            "http_code": 200,

            "document": {

                "pak_id": "vRealizeOperationsManagerEnterprise-81116522883",

                "pak_state": "DISTRIBUTED",>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Okay

                "pak_install_status": "CANDIDATE",

                "pak_distribution_progress": null,

                "current_action": null,

                "node_unchanged": true,

                "failed_details": null,

                "warning_details": null,

                "orchestrator_action": "UNKNOWN",

                "pre_upgrade_validation_results_available": false,

                "log_links": []

            },

            "content_type": "application/json"

        }

    ],

    "cluster_data": {

        "cluster_action_failed": false,

        "cluster_action_failed_time": null,

        "cluster_action": "NO_ACTION"

    }

}

 =======End here

I generally write post in hurry so please avoid any spelling or formatting slip-up due to lack of time but technical stuff is never compromised. Feel free to write me back in case of any confusion.

 

Thank you,
Gautam Johar

 


Wednesday, 2 September 2020

Welcome to my Notes!

Hello Folks,

I would like to introduce myself as Gautam Johar and learner of VMware's technologies but not limited to. I am part of many VMware Slack community like #vExpert #CloudServiceProviders #VMware{code} #Kubernetes and try to learn something new as my daily goal.

Initially, I created this blog for my own purpose but now when I know that it can help many out there so I started creating post with that perspective as well. I am always keen to work on challenging tasks and would be happy if anyone wants to share their challenges and seeking efficient solutions.

I don't write basics and sorry for that. Basics is already covered on web. I just put solutions of issues and solutions of challenges.

Whatever I learnt from community, I want to give it back who needs it. If you want, you can donate me any amount at my UPI ID: gautamjohar-it@icici as a token of appreciation. Also, if I will get some money then I will keep my blog ads free to give you better experience while reading it.

 

Happy Learning!
Gautam Johar

Tuesday, 18 August 2020

PowerShell | Filter HA events from vCenter server

Hello Guys,

It is well explained on web but I want to have it on my blog so that I don't keep roaming on web to find the same again. After all, it is my notes. isn't it? ;)

Command is simple as below


Get-VIEvent -MaxSamples 100000 -Start (Get-Date).AddDays(-1) -Type Warning | Where {$_.FullFormattedMessage -match "restarted"} |select CreatedTime,FullFormattedMessage | sort CreatedTime –Descending
 

Hope it helped you as well.

 

Thank you,
vCloudNotes

 

Thursday, 13 August 2020

VCD | Upload or Download an ISO file to and from vCD catalog

Hello Guys,

In my previous post I shared to upload or download OVA\OVF file, now let's have a look on how you can do the same for an .iso file. It is quite similar.

To Download

ovftool  "vcloud://gjohar@mylab.com?org=GautamJohar&catalog=Test&media=Win2k19.iso"
"C:\Users\gjohar\Desktop\password_recovery_cd110511.iso"

To upload, simply reverse the command as below

 ovftool "C:\Users\gjohar\Desktop\password_recovery_cd110511.iso" "vcloud://gjohar@mylab.com?org=GautamJohar&catalog=Test&media=Win2k19.iso"

Explanation of above commands you can see in post

It is quite possible that you face error due to many reasons so feel free to let me know in case you need any further help on the same.



Thank you,
vCloud Notes

Sunday, 21 June 2020

VCD | Upload or Download an OVA\OVF file to and from Org vDC with ovftool

Hi Guys,

First of all I am sorry that I couldn't write up since last few days due to some personal work. But today I got some time and I thought to write about the subject.

I have seen many techy guys struggling with ovftools to upload the ova\ovf file into orgvDC. Generally, people love to upload ovf\ova file through GUI but sometime it just doesn't work due to x reason then you have this alternate way of uploading it. You can also use ovftool to see the exact error\progress while uploading it. Ovftool is helpful in many other operations but today's post is to learn that How to upload ova\ovf file through ovftool. right?

Now, as you know that I prefer to write some unique content or the content with enough elaboration that anyone can understand it. So, I saw a few article on this subject which I think will be little bit difficult for a lesser expert person to understand.

So, I will not only put the text here but also will create a clear video and will make sure that every info here will just work perfectly.

Below is the command -

To download

ovftool "vcloud://gjohar@vcd1.homelabs.com?org=vcnotes&catalog=Test&vappTemplate=Windows_2019" "C:\temp\Windows_2019.ova"

Explanation-

ovftool - It is the command string, you need to use
vcloud - It is to tell the ovftool that this operation is to be taken for vcloud director
gjohar - user account name created in org "vcnotes"
vcd1.homelabs.com - VCD URL to use with third party tools like ovftools
Test - It is the catalog name from where we are downloading the ova named Windows_2019
Windows_2019 - It is the vapp template or ova which is stored in Catalog named Test.

As per above command, we are downloading it to Temp directory. Also, just change the extension to Windows_2019.ovf, if you want to download ovf file. Got it?

To upload


ovftool "C:\temp\Windows_2019.ova" "vcloud://gjohar@vcd1.homelabs.com?org=vcnotes&catalog=Test&vappTemplate=Windows_2019"

it is just the reverse action. In above command, the ova file placed in C:\temp with given name will be uploaded into the catalog Test with name Windows_2019 in Org named "vcnotes" and with user account gjohar.

Hope it was easy.

I will buy sometime to create a video on it. Actually, I will be away from vCD terminal for next few days. In case, anyone still have some issues with this download and uploading ova/ovf file then you can share you vcd terminal and I will help you live ;)

In my next post, I will write about uploading and download ISO file. We will use ovftools only and it has little different command than uploading\download ova\ovf file.

Keep visiting the blog guys!


Thank you,
vCloudNotes





Thursday, 4 June 2020

PS | Script to detect and delete the Orphaned Files

Hi Guys,

Someone recently asked about the script which can detect the orphaned files in a datastore and can remove it with full control and condition was, it should not show the files which are not modified since last x number of days rather it should show the files which are not connected with any VM.

I did little effort and could find that such task is already done brilliantly by someone on Internet.

What I tested -

I removed one vmdk file from VM and then ran the script it exactly shows the vmdk which I removed and then run the command to delete it but it tried to delete entire folder. Go through below line, it will be clear.

Below is the script-

#Start here
function Remove-OrphanedData {
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[parameter(Mandatory=$true,ValueFromPipeline=$true)]
[PSObject[]]$Datastore,
[switch]$Delete
)
begin{
$fldList = @{}
$hdList = @{}
$fileMgr = Get-View FileManager
}
process{
foreach($ds in $Datastore){
if($ds.GetType().Name -eq "String"){
$ds = Get-Datastore -Name $ds
}
if($ds.Type -eq "VMFS" -and $ds.ExtensionData.Summary.MultipleHostAccess){
Get-VM -Datastore $ds | %{
$_.Extensiondata.LayoutEx.File | where{"diskDescriptor","diskExtent" -contains $_.Type} | %{
$fldList[$_.Name.Split('/')[0]] = $_.Name
$hdList[$_.Name] = $_.Name
}
}
Get-Template | where {$_.DatastoreIdList -contains $ds.Id} | %{
$_.Extensiondata.LayoutEx.File | where{"diskDescriptor","diskExtent" -contains $_.Type} | %{
$fldList[$_.Name.Split('/')[0]] = $_.Name
$hdList[$_.Name] = $_.Name
}
}
$dc = $ds.Datacenter.Extensiondata
$flags = New-Object VMware.Vim.FileQueryFlags
$flags.FileSize = $true
$flags.FileType = $true
$disk = New-Object VMware.Vim.VmDiskFileQuery
$disk.details = New-Object VMware.Vim.VmDiskFileQueryFlags
$disk.details.capacityKb = $true
$disk.details.diskExtents = $true
$disk.details.diskType = $true
$disk.details.thin = $true
$searchSpec = New-Object VMware.Vim.HostDatastoreBrowserSearchSpec
$searchSpec.details = $flags
$searchSpec.Query += $disk
$searchSpec.sortFoldersFirst = $true
$dsBrowser = Get-View $ds.ExtensionData.browser
$rootPath = "[" + $ds.Name + "]"
$searchResult = $dsBrowser.SearchDatastoreSubFolders($rootPath, $searchSpec)
foreach($folder in $searchResult){
if($fldList.ContainsKey($folder.FolderPath.TrimEnd('/'))){
foreach ($file in $folder.File){
if(!$hdList.ContainsKey($folder.FolderPath + $file.Path)){
New-Object PSObject -Property @{
Folder = $folder.FolderPath
Name = $file.Path
Size = $file.FileSize
CapacityKB = $file.CapacityKb
Thin = $file.Thin
Extents = [string]::Join(',',($file.DiskExtents))
}
if($Delete){
If ($PSCmdlet.ShouldProcess(($folder.FolderPath + " " + $file.Path),"Remove VMDK")){
$dsBrowser.DeleteFile($folder.FolderPath + $file.Path)
}
}
}
}
}
elseif($folder.File | where {"cos.vmdk","esxconsole.vmdk" -notcontains $_.Path}){
$folder.File | %{
New-Object PSObject -Property @{
Folder = $folder.FolderPath
Name = $_.Path
Size = $_.FileSize
CapacityKB = $_.CapacityKB
Thin = $_.Thin
Extents = [String]::Join(',',($_.DiskExtents))
}
}
if($Delete){
if($folder.FolderPath -eq $rootPath){
$folder.File | %{
If ($PSCmdlet.ShouldProcess(($folder.FolderPath + " " + $_.Path),"Remove VMDK")){
$dsBrowser.DeleteFile($folder.FolderPath + $_.Path)
}
}
}
else{
If ($PSCmdlet.ShouldProcess($folder.FolderPath,"Remove Folder")){
$fileMgr.DeleteDatastoreFile($folder.FolderPath,$dc.MoRef)
}
}
}
}
}
}
}
}
}
Remove-OrphanedData -datastore Name_of_datastore


#It will give you below kind of output


Now, if you want to delete this then use below command

Remove-OrphanedData -datastore Name_of_datastore -delete

But before deleting it, let's see what it will be delete. See below pic. I have added a switch -whatif in last after -delete switch.


It will delete entire folder not only single file.

Now, It is up to you that whether you want to remove the entire folder by adding only -delete switch or if you want to delete only vmdk file not entire folder and that will be manual action.

In my case, deletion gave error while deleting the entire folder, might be due to in-use vmx file or so...

Any doubt, let's discuss.

That's it for now. Enjoy the learning!




Thank you,
vCloudNotes