Link to home
Start Free TrialLog in
Avatar of SK MASTAN Vali
SK MASTAN Vali

asked on

Connecting to O365 via Powershell in Remote Desktop( windows Server2012)

Hi Every one,

Please solve given below issue..

We are Connecting to O365 via Powershell in Remote Desktop( windows Server2012) but it is giving an error ...

please anyone help me...

New-PSSession : Parameter set cannot be resolved using the specified named parameters. At line:57 char:14 + $Session = New-PSSession -ComputerName "pshell-msteam.pshell.com" -Configurati ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-PSSession], ParameterB indingException + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Comma nds.NewPSSessionCommand Import-PSSession : Cannot bind parameter 'Session'. Cannot convert the "System.Web.SessionState.HttpSessionState" value of type "System.Web.SessionState.HttpSessionState" to type "System.Management.Automation.Runspaces.PSSession". At line:58 char:28 + $temp = Import-PSSession $Session -allowclobber -warningaction silentlycontinu ... + ~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Import-PSSession], Paramet erBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerSh ell.Commands.ImportPSSessionCommand Connect-MsolService : Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown. At line:60 char:3 + Connect-MsolService -Credential $Credentials -warningaction silentlycontinue + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Connect-MsolService], Mic rosoftOnlineException + FullyQualifiedErrorId : 0x80070005,Microsoft.Online.Administration.Autom ation.ConnectMsolService
ASKER CERTIFIED SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The answer is provided in the Powershell error:

New-PSSession : Parameter set cannot be resolved using the specified named parameters. At line:57 char:14 + $Session = New-PSSession -ComputerName "pshell-msteam.pshell.com" -Configurati ... +


The Powershell commands Kimputer provided are correct if you want to copy and paste everytime, or you could add the following script to the Powershell profile and all you have to type is Connect-ExchangeOnline which will tab-complete.

Function Connect-FuturaRemotePowershell
{
	$username = "username"
	$password = "password" | ConvertTo-SecureString -AsPlainText -Force
	$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
	$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic -AllowRedirection
	Import-PSSession $session
}

Open in new window