By default PowerShell is configured to not allow to execute PowerShell scripts on Windows systems. But sometimes one needs to execute script without having local administrator rights.
The most common way is to allow script execution by the following command:
Set-ExecutionPolicy RemoteSigned
To bypass this policy you need to create PowerShell script file, e.g. runme.ps1 and execute in the following way:
Get-Content .\runme.ps1 | Invoke-Expression
WinRm configuration script:
winrm quickconfig -quiet winrm set winrm/config/Client/Auth '@{Basic="true"}' winrm set winrm/config/Service/Auth '@{Basic="true"}' winrm set winrm/config/Service '@{AllowUnencrypted="true"}'