Open file in the cloud

I know this is a PowerShell forum but I figured the technical expertise would be found here.

I need to do the following. Machine abc does not have Office installed locally. A user who is logged into machine abc goes to a network share and double clicks on an Office doc (.xlsx, docx etc…) I need that document to launch in

Now, I can modify the File Association and point any .xlsx or docx file to run a custom PowerShell Script. This PowerShell script looks like this:

(if an Excel file was clicked on…)

if (Test-Path “C:\Program Files\Microsoft Office 15\root\office15\Excel.exe”){start-sleep -m 1}
ELSE {cmd.exe /c “C:\Program Files\Internet Explorer\iexplore.exe” ""}

My issue is this does not open the document that was actually clicked on. How would that be done? So the file could be something like this: \Server\Share\SubFolder\SubFolder2\Expense Report for January 2017.xlsx

How would you launch that in Office.Live with Powershell?

You’re right; this really isn’t a PowerShell question. I’m not sure you’d even want to go about it that way. It seems like you’d want some kind of stub handler locally to deal with this, so the file icons and whatnot don’t get screwed up. And I’m not even sure what rules Office Online has for opening local documents, versus cloud-stored ones; I know that’s a potential security concern of epic proportions, so it might not be easy by design.