+ Post New Thread
Results 1 to 12 of 12
Cloud Services Thread, Office 365 Exchange Connection URI in Technical; Got an issue connecting to Office 365 to disable activesync for a specific set of users however I don't seem ...
  1. #1

    Join Date
    Aug 2012
    Location
    Solihull
    Posts
    96
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    4

    Office 365 Exchange Connection URI

    Got an issue connecting to Office 365 to disable activesync for a specific set of users however I don't seem to be able to connect to the URI, any ideas what the URI should be?


    $Session
    =New-PSSession-ConfigurationNameMicrosoft.Exchange-ConnectionUri"https://outlook.com/domain-name.com/"


    Error:

    New-PSSession : [outlook.com] Connecting to remote server outlook.com failed with the following error message : WinRM cannot complete the operation. Verify

    that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled

    and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local

    subnet. For more information, see the about_Remote_Troubleshooting Help topic.

    At C:\SWSC Office 365 Scripts\Office 365\Students_Provision_Disable_Services.ps1:6 char:12

    + $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "h ...

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

    + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException

    + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

    Import-PSSession : Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument, and then try running the

    command again.

    At C:\SWSC Office 365 Scripts\Office 365\Students_Provision_Disable_Services.ps1:7 char:18

    + Import-PSSession $Session

    + ~~~~~~~~

    + CategoryInfo : InvalidData: ( [Import-PSSession], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerSh ell.Commands.ImportPSSessionCommand

  2. #2
    andyrite's Avatar
    Join Date
    Apr 2007
    Posts
    412
    Thank Post
    7
    Thanked 90 Times in 71 Posts
    Rep Power
    41
    https://outlook.com/domain-name.com/ looks odd.

    Try

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
    Import-PSSession $Session

  3. #3

    Join Date
    Aug 2012
    Location
    Solihull
    Posts
    96
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    4
    I've tried:

    $Session=New-PSSession-ConfigurationNameMicrosoft.Exchange-ConnectionUrihttps://ps.outlook.com/powershell/-Credential$Cred-AuthenticationBasic-AllowRedirection
    Import-PSSession$Session
    Get-User-RecipientTypeDetailsUserMailbox|where {$_.Title -eq"Student User"} |Set-CASMailbox-ActiveSyncEnabled$False

    Still the same issue

  4. #4
    andyrite's Avatar
    Join Date
    Apr 2007
    Posts
    412
    Thank Post
    7
    Thanked 90 Times in 71 Posts
    Rep Power
    41
    The text you just posted doesn't have any spaces in. Is that a pasting issue?

  5. #5

    Join Date
    Aug 2012
    Location
    Solihull
    Posts
    96
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    4
    yeah definitely a pasting issue
    Attached Images Attached Images

  6. #6

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,047
    Thank Post
    160
    Thanked 913 Times in 716 Posts
    Blog Entries
    3
    Rep Power
    271
    If you want to connect to both Azure Active Directory & Exchange Online at the same time this will do what you want:

    Import-Module msonline
    $cred = Get-Credential
    Connect-MsolService -cred $cred
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    Regards,
    James.

  7. #7

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,047
    Thank Post
    160
    Thanked 913 Times in 716 Posts
    Blog Entries
    3
    Rep Power
    271
    If you are running a script that contains variables '$something' and this variable is not set within the script you are running then you need to ensure that before you run the script that the variable is set globally so that when a script is run it can get the variable.

    The error your getting is stating that $session equal $null and so therefore when the script attempts to carry out the action, because it can't find anything in $session it throws an exception.

    James.

  8. #8

    Join Date
    Aug 2012
    Location
    Solihull
    Posts
    96
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    4

    Still the same

    Import-Modulemsonline

    $cred
    =Get-Credential

    Connect-MsolService
    -cred$cred

    $Session
    =New-PSSession-ConfigurationNameMicrosoft.Exchange-ConnectionUrihttps://ps.outlook.com/powershell-Credential$cred-AuthenticationBasic-AllowRedirection

    Import-PSSession
    $Session


     

    Get-User
    -RecipientTypeDetailsUserMailbox|where {$_.Title -eq"Student User"} |Set-CASMailbox-ActiveSyncEnabled$False


    Capture.JPG


  9. #9

    Join Date
    Aug 2012
    Location
    Solihull
    Posts
    96
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    4
    I've put a service request in with MS to see if they can resolve this...

  10. #10

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,047
    Thank Post
    160
    Thanked 913 Times in 716 Posts
    Blog Entries
    3
    Rep Power
    271
    Stephen,

    The syntax in the command you are using is not correct

    Get-User -RecipientTypeDetailsUserMailbox

    This should be

    Get-User -RecipientTypeDetails UserMailbox | where {$_.Title -eq "Student User"} | Set-CASMailbox -ActiveSyncEnabled $false
    In terms of the error message your getting, looks like your have connectivity issues more than anything else or/ it's connecting to an on-premise exchange server? :/ anyway above is the correct syntax for the command. :-)

    James.
    Last edited by EduTech; 25th June 2014 at 02:35 AM.

  11. #11

    Join Date
    Aug 2012
    Location
    Solihull
    Posts
    96
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    4
    Haahaa School Boy error:

    netsh WINHTTP import proxy source =ie


    Now all hunky dory:

    Import-Module msonline
    $cred = Get-Credential
    Connect-MsolService -cred $cred
    $Session = New-PSSession -ConfigurationNameMicrosoft.Exchange -ConnectionUri https://ps.outlook.com/powershell-Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $Session

    cmdlet Get-Credential at command pipeline position1
    Supply values for the following parameters:
    WARNING: Your connection has been redirected to thefollowing URI: "https://podXXXXXpsh.outlook.com/powershell-liveid?PSVersion=4.0"
    WARNING: The names of some imported commands fromthe module 'tmp_cuyndfqy.jnd' include unapproved verbs that might make themless discoverable. To find the
    commands with unapproved verbs, run theImport-Module command again with the Verbose parameter. For a list of approvedverbs, type Get-Verb.

    ModuleType Version Name ExportedCommands
    ---------- ------- ---- ----------------
    Script 1.0 tmp_cuyndfqy.jnd {Add-AvailabilityAddressSpace, Add-DistributionGroupMember,Add-MailboxFolderPermission, Add-Ma...


    Last edited by StephenHardy; 25th June 2014 at 11:22 AM.

  12. #12

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,047
    Thank Post
    160
    Thanked 913 Times in 716 Posts
    Blog Entries
    3
    Rep Power
    271
    Quote Originally Posted by StephenHardy View Post
    Haahaa School Boy error:

    netsh WINHTTP import proxy source =ie


    Now all hunky dory:

    Import-Module msonline
    $cred = Get-Credential
    Connect-MsolService -cred $cred
    $Session = New-PSSession -ConfigurationNameMicrosoft.Exchange -ConnectionUri https://ps.outlook.com/powershell-Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $Session

    cmdlet Get-Credential at command pipeline position1
    Supply values for the following parameters:
    WARNING: Your connection has been redirected to thefollowing URI: "https://podXXXXXpsh.outlook.com/powershell-liveid?PSVersion=4.0"
    WARNING: The names of some imported commands fromthe module 'tmp_cuyndfqy.jnd' include unapproved verbs that might make themless discoverable. To find the
    commands with unapproved verbs, run theImport-Module command again with the Verbose parameter. For a list of approvedverbs, type Get-Verb.

    ModuleType Version Name ExportedCommands
    ---------- ------- ---- ----------------
    Script 1.0 tmp_cuyndfqy.jnd {Add-AvailabilityAddressSpace, Add-DistributionGroupMember,Add-MailboxFolderPermission, Add-Ma...


    ;-) so it was connectivity then. It's okay you'll be surprised the amount of people that actually have this issue because they forget about the proxy servers.

SHARE:
+ Post New Thread

Similar Threads

  1. Office 365 & Exchange 2013
    By mikkydoos in forum Cloud Services
    Replies: 0
    Last Post: 30th January 2014, 10:08 AM
  2. Office 365 Exchange PowerShell drop outs
    By dcwhitworth in forum Cloud Services
    Replies: 1
    Last Post: 9th January 2014, 09:06 AM
  3. [Office 365] Outlook Connectivity through proxy
    By Cache in forum Cloud Services
    Replies: 15
    Last Post: 17th December 2013, 03:40 PM
  4. Office 365 & Exchange 2007
    By Edu-IT in forum Windows
    Replies: 6
    Last Post: 14th October 2013, 08:38 PM
  5. Office 365 Exchange Online now 50GB Mailbox per user!
    By EduTech in forum Cloud Services
    Replies: 50
    Last Post: 18th September 2013, 03:33 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •