Share via

getting error while connecting on powershell

Anonymous
2019-03-11T23:45:27+00:00

PS D:\Users\Shruti.Chiddarwar> $UserCredential = Get-Credential

cmdlet Get-Credential at command pipeline position 1

Supply values for the following parameters:

Credential

PS D:\Users\Shruti.Chiddarwar> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://out

look.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic –AllowRedirection

PS D:\Users\Shruti.Chiddarwar> Import-PSSession $Session

Import-PSSession : Files cannot be loaded because running scripts is disabled on this system. Provide a valid

certificate with which to sign the files.

At line:1 char:1

+ Import-PSSession $Session

+ ~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo          : InvalidOperation: (:) [Import-PSSession], PSInvalidOperationException

+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ImportPSSessionCommand

Microsoft 365 and Office | Subscription, account, billing | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2019-03-12T03:13:04+00:00

Hi Chiddarwar,

Based on the error message that "running scripts is disabled on this system", it seems that it was caused by PowerShell execution policy permission, as an administrator, please set the execution policy by typing this command into your PowerShell window to set the user preference for the shell execution policy to RemoteSigned and see if it helps.

Set-ExecutionPolicy RemoteSigned

For more detailed information please see: Set-ExecutionPolicy

Regards,

Bryan

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-04-24T19:02:05+00:00

    I received the same error message, and I had used the Set-ExecutionPolicy RemoteSigned at the very beginning and I still received the same error message.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-03-14T10:11:19+00:00

    Hi Chiddarwar,

    Do you still need our help? Feel free to let us know.

    Regards,

    Bryan

    Was this answer helpful?

    0 comments No comments