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
SK MASTAN ValiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KimputerCommented:
My code looks like this and never gave me problems:

$Cred = Get-Credential
$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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason CrawfordTransport NinjaCommented:
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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.