Get mobile devices for cloud users

Welcome Forums General PowerShell Q&A Get mobile devices for cloud users

Viewing 4 reply threads
  • Author
    Posts
    • #146763
      Hil
      Participant
      Topics: 34
      Replies: 46
      Points: 265
      Rank: Contributor

      This is part of a larger script and I want to focus my question on a particular aspect.

      What I run this command, it returns the first 10 devices and then hangs. I can do a ctrl-c to break out.

      Any ideas why? Any way around it. I wan to avoid using the get-mailbox and a for loop to Get-MobileDevice as that would take forever.
      Get-MobileDevice | Select-Object -First 10 | ft

    • #146765
      Participant
      Topics: 10
      Replies: 2480
      Points: 6,538
      Helping Hand
      Rank: Community MVP

      Are you sure it hangs? Give it a little more time. Try it.

    • #146780
      Senior Moderator
      Topics: 9
      Replies: 1449
      Points: 5,429
      Helping Hand
      Rank: Community MVP

      The hang can be in next immediate or somewhere down the line in your script. its better to debug using an editor (VSCode or PowerShell ISE) to confirm the point where it hangs.

    • #146814
      Hil
      Participant
      Topics: 34
      Replies: 46
      Points: 265
      Rank: Contributor

      No. When I have the command as “Select-Object -First 10” and the scripts returns 10 items it means the script is complete and should return to the prompt but it just sits there.

      Its just a single line of powershell code, so there should be no error in the line itself. Try it out. you will see what I mean.

    • #146823
      Participant
      Topics: 10
      Replies: 2480
      Points: 6,538
      Helping Hand
      Rank: Community MVP

      Of course I tried before I answered. The command line delivers the 10 rows and then takes a few moments to come back and show the prompt. It takes some seconds but it does not hang. The time Powershell needs may depend on the size of the environment.

Viewing 4 reply threads
  • The topic ‘Get mobile devices for cloud users’ is closed to new replies.