Hello
I would like to connect to various Office 365 powershells directly from RemoteDesktopManager. My problem is the credential delivery. Normally I get the credentials with:
$LiveCred = GetCredential
Then a credential window pops up and I have to enter the crendetials of the Office 365 account I wish to connect with.
But I want to enter the credentials in the connection setting in RDM and call them together with the script. I have searched for other possibilities and found a way to setup the PSCredential manually from command line options, wich I can feed with RDM:
$User = $args[0]
$Pass = ConvertTo-SecureString -String "$args[1]" -AsPlainText -Force
$LiveCred = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $Pass
But I get allways an error connecting to the Office 365 remote powershell (no access). Any ideas?
The complete script I call from RDM looks like this:
---$User = $args[0]
$Pass = ConvertTo-SecureString -String "$args[1]" -AsPlainText -Force
$LiveCred = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $Pass
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Import-Module MSOnline
Connect-MsolService -Credential $LiveCred
---
Oliver
edited by OTimme on 6/12/2013
I would like to connect to various Office 365 powershells directly from RemoteDesktopManager. My problem is the credential delivery. Normally I get the credentials with:
$LiveCred = GetCredential
Then a credential window pops up and I have to enter the crendetials of the Office 365 account I wish to connect with.
But I want to enter the credentials in the connection setting in RDM and call them together with the script. I have searched for other possibilities and found a way to setup the PSCredential manually from command line options, wich I can feed with RDM:
$User = $args[0]
$Pass = ConvertTo-SecureString -String "$args[1]" -AsPlainText -Force
$LiveCred = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $Pass
But I get allways an error connecting to the Office 365 remote powershell (no access). Any ideas?
The complete script I call from RDM looks like this:
---$User = $args[0]
$Pass = ConvertTo-SecureString -String "$args[1]" -AsPlainText -Force
$LiveCred = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $Pass
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Import-Module MSOnline
Connect-MsolService -Credential $LiveCred
---
Oliver
edited by OTimme on 6/12/2013