In order to enable SharePoint Online PowerShell Script execution from your remote machine, below are the steps required to follow on remote machine,
Step 1
SharePoint Server 2013 Client Components SDK – Download and Install at your Remote machine, Download SharePoint Server Client SDK .
This is required to enable usage of CSOM to your PowerShell script for O365 tenant.
Download as per available remote machine environment,
Install after download,
Step 2
Install Windows PowerShell 3.0 from Windows Management Framework 3.0 .
Step 3
Install the SharePoint Online Management Shell from the Microsoft Download Center .
Step 4
Set the policies, if not already set,
Check policies by using Windows PowerShell script command,
Get-ExecutionPolicy -List
The result will look similar to the following sample output:
Scope ExecutionPolicy
—– —————
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine AllSigned
If not as above, use below command,
Set-ExecutionPolicy -ExecutionPolicy <PolicyName>
e.g to set CurrentUser policy,
Set-ExecutionPolicy -ExecutionPolicy CurrentUser
When it ask for value use below,
Click here for detailed information on RemoteSigned
Hope you find this article useful.