Code Capture records user actions and translates them into executable code.

Code Capture gives you the ability to record actions taken in the vSphere Client and output them as usable PowerCLI code. You can then copy the code or download it as a script and use it in a PowerShell session to execute the task.
Note: Only vCenter Server calls are recorded. Calls made on operations regarding roles, privileges, tags, content libraries, and storage policies are not recorded.