Luc Dekens has the right answer as always.
You need first the others functions. (I like the copy paste approach, even if it is not the best)
Keep in mind that the function get-ProbablyOrphanedFile is actually quite complex with a mix of API call, PowerShell workflow, call of others function and there are no errors handling.
Moreover, it was developed a long time ago, and I have not tested it with new version. It should still work if the API have not been modified but this is not guaranteed.
It is suitable for experienced PowerCLI user that will have the skills to adapt and troubleshoot it as needed.
For your scenario, I will recommend a step by step troubleshooting.
Step 1: Get the correct list of datastores
Get-datastore | where {$_.something -eq “something”}
I do not think that there is a “Drive Type” property for a PowerCLI datastore object, so it is not possible to use something like $_.DriveType -eq "SSD".
Online Documentation - Cmdlet Reference - VMware {code}
However, I think the information that you are looking for is the “ssd” property of the API object “Host.VmfsVolume”
https://vdc-repo.vmware.com/vmwb-repository/dcr-public/fa5d1ee7-fad5-4ebf-b150-bdcef1d38d35/a5e46da1-9b96-4f0c-a1d0-7b8f…
It is possible to “jump” from a powershell Datastore to an API datastore via “.extensiondata” property.
For more details about the core concepts of PowerCLI:
http://thecrazyconsultant.com/powercli-study-guide-core-concepts/
(This guide is not up to date but the majority of concepts still apply today)
Step 2: Try the function “Get-FileInDatastore” alone with only one datastore and your pattern
Get-datastore “Datastorename” | Get-FileInDatastore –matchPattern “YourPattern”
The goal is to check if the pattern is correct. (I am not sure if the pattern “*.vmx”| ogv" works.)
Actually, the format expected for this “pattern” is not well documented in the API.
https://code.vmware.com/doc/preview?id=4206#/doc/vim.host.DatastoreBrowser.SearchSpec.html
Step 3: Try the function “get-FileInDatastoreWithWorkflow” alone
Step 4: Try the function “Get-FilesIdentifiedAsAssociatedToAllVMs” alone
Step 5: Try the function "get-ProbablyOrphanedFile"