PSProvider and VMware datastore – PowerCLI

Hello everyone,

I am writing this short blog after a long time. While explaining in-out of PowerShell to some of my friends in person, I discussed about PSProviders. Most of the knowledge about PSProvider is information only and as a script writer we dont really bother about how powershell is playing with different resources (Variable/function/Filesystem/Registery Keys etc) which are used in PowerShell Session or a Script.

However as a VMware Admin I do use PSProvider in background alot in order to move the datastore item from,

  1. datastore to datastore
  2. Datastore to local drive (Windows Drive or Shared Drive) or vice versa

In this Post we will learn about Copy-DatastoreItem cmdlet and PSProviders.

What is PSProvider?

In Simple Term, PSProviders are special repository(data stored within Powershell)  to process the data as it recieves during PowerShell execution. This data is presented in their respective PowerShell drives which are known as PSDrive.

For Ex. See the below command output from Get-PSProvider

Get-Provider.PNG

by default, you get above psproviders which are registry, Alias, Environment, Filesystem, Function and variable. You can also see the respective drives associated to its PSProvider. This means that if you are creating any variable it will be stored in variable: , If you are creating a function then it will be stored in Function: 

check the below image, where i am going into respective drive and able to see the variable which i have created. 

CDVariable

In conclusion, whatever variable/function/etc which I create in powershell gets stored in their respective drives.

vimstore PSProvider. 

vimstore is a one of the PSProvider which you get after connecting to VMware vCenter via PowerCLI. Do this, Connect-VIServer vCenter-ip and then run get-PSProvider cmdlet and you will see additional PSProviders are available to you. These providers are something which provides VMware Inventory and datastore resources to the POwerCLI or PowerShell.
POwerCLIProviders

So, After connecting to vCenter via PowerCli you can see additional PSDrives are available to you, provided by 2 additional PSProviders. I can do cd vmstore: and can actually list the available datastore in the datastore inventory (Simillar to how we list the directories and files in a path) or can list the host inventory.

Once you are connected you can follow below commands to create a New-PSDrvive with ‘Vimdatastore’ PSProvider.

DatastoreDS

Now you have DS: drive which is available to you and you can basically navigate through the same way you do it for any other drive.

Use below command to move data from your local drive to the VMware datastore using PowerCLI. Please note that i am already in DS: , If you are in any other drive then give proper path using vimdatastore drive

copydatastore.PNG

Note: This method is quite helpful in case you are trying to move things around from datastore and you can automate the move operation. also this is an alternate to certificate error which you may receive while moving data from Web Client. For ex, Operation failed when I tried to upload the same ISO using web client.

CertError

Use PowerCLI vimdatastore Psprovider and copy-datastoreitem cmdlet to work around this.

 

Thanks

Jatin

 

 

 

 

 

 

 

 

 

VMware Home Lab – Ravello

After a long time, I am coming back here and sharing my work, experience, and thoughts with all of you. A year back I started writing blogs about technology but it quickly went under the carpet and couldn’t able to continue the same. I felt that without having my own lab i won’t be able to engage with the community the way i wanted to. So here I am with my off-premise cloud lab.

I was doing a little bit of research to get the best lab setup for my learning and thought about Intel NUC to consider my physical hosts but quickly realized that it won’t be a good idea to have a bunch of physical hosts and dangling cables at my home. I didn’t feel the need for the on-prem lab as it was not offering me any additional benefits. So the only option left for me was to set up my VMware lab on the Public Cloud.

There were mainly 3 reasons for opting out a cloud-based solution.

  • Pay as you Go, the Capital cost of setting up the on-prem home lab was very high for me.

 

  • Scalability, ability to scale up/down compute resources is simply a cakewalk for us, all thanks to virtualization and cloud infrastructure. Scalability by default allows you to optimize your resources and results in an efficient infrastructure, However, that’s not the case with the hardware infrastructure. 

 

  • Hardware refresh, a typical lifecycle of any hardware is around 3-5 years and after that, it requires an upgrade to catch up with the trend. It is certainly not a good idea to have a bunch of hardware (Host, switches, Routers etc.) and periodically upgrading them. you simply can’t afford hardware maintenance cost just to keep your Lab infrastructure running.

927091980

#Ravello

Ravello was a startup founded by few KVM hypervisor developers and after that, it was acquired by Oracle. The unique ability of nested virtualization provided by #ravello allows us to host ESXi as a virtual machine on HVX hypervisor. I guess it is the only cloud provider which is offering nested virtualization thus becoming the only option for hosting VMware home lab on the public cloud. I figured it out about Ravello a few months back but at that time Ravello offering was not available for trial in India. However, the good news is that it’s now available for 30 days trial and has very competitive rates. It provides all the key feature which requires you to get started.

The interesting thing which I liked most about Ravello is, it provides key network services like DNS, DHCP, L2/L3 networking layer, VLAN and firewall services on the fly, Which essentially means that you can save few $$$ by not to deploy additional VM just to use these services for your lab environment.

As of today, I am able to setup 3 ESXi hosts, 1 VCSA 6.5, and a windows server 2016. Able to quickly configure my lab environment with public IPs so that I can seamlessly access all my workloads over the internet as an when required. In fact, I was impressed with the new ESX #H5client which was accessible on my smartphone and giving seamless experience on my mobile phone though it’s not a required thing for production infrastructure.

Take a look at below screenshot of ESXi which was accessed over the internet on a mobile browser.

Lab

The plan is to build this lab environment with different use cases, test vSphere upgrades with different test scenarios, and to build/test cloud-based automation solutions around it. I will keep sharing interesting use cases and “how to” stuff as I go along with this.

Feel free to post your queries, feedback or suggestions on “Virtual Reality” 

Thanks,