This topic is resolved

Share

This topic contains 3 replies, has 4 voices, and was last updated by  Karim Buzdar 1 month, 1 week ago.

  • Author
    Posts
  • #277985
     Adrian Higueros 
    Participant
    • Topics: 2
    • Replies: 0
    Member Points: 62
    Rank: Level 1

    I have the powershell script below. Can anyone help me be able to filter it so it only applies to a group in AD. lets say “all staff”

     

     

    $csv = “C:\Reports\MobileDevices.csv”
    $results = @()
    $mailboxUsers = get-mailbox -resultsize unlimited
    $mobileDevice = @()

    foreach($user in $mailboxUsers)
    {
    $UPN = $user.UserPrincipalName
    $displayName = $user.DisplayName

    $mobileDevices = Get-MobileDevice -Mailbox $UPN

    foreach($mobileDevice in $mobileDevices)
    {
    Write-Output “Getting info about a device for $displayName”
    $properties = @{
    Name = $user.name
    UPN = $UPN
    DisplayName = $displayName
    FriendlyName = $mobileDevice.FriendlyName
    ClientType = $mobileDevice.ClientType
    ClientVersion = $mobileDevice.ClientVersion
    DeviceId = $mobileDevice.DeviceId
    DeviceMobileOperator = $mobileDevice.DeviceMobileOperator
    DeviceModel = $mobileDevice.DeviceModel
    DeviceOS = $mobileDevice.DeviceOS
    DeviceTelephoneNumber = $mobileDevice.DeviceTelephoneNumber
    DeviceType = $mobileDevice.DeviceType
    FirstSyncTime = $mobileDevice.FirstSyncTime
    UserDisplayName = $mobileDevice.UserDisplayName
    }
    $results += New-Object psobject -Property $properties
    }
    }

    $results | Select-Object Name,UPN,FriendlyName,DisplayName,ClientType,ClientVersion,DeviceId,DeviceMobileOperator,DeviceModel,DeviceOS,DeviceTelephoneNumber,DeviceType,FirstSyncTime,UserDisplayName | Export-Csv -notypeinformation -Path $csv

    0
  • #278850
     Michael Pietroforte 
    Keymaster
    • Topics: 138
    • Replies: 337
    Post count: 1046
    Member Points: 7,244
    Rank: Level 1

    According to this post you can filter by group with this command:

    0
    • #301435
       Clayton 
      Participant
      • Topics: 0
      • Replies: 1
      Post count: 3
      Member Points: 29
      Rank: Level 1

      The “VoicemailEnabled” would be your AD group you would change to your specific group you are needing to search within.

      1+

      Users who have liked this topic:

      • avatar
  • #304334
     Karim Buzdar 
    Moderator
    • Topics: 24
    • Replies: 80
    Post count: 251
    Member Points: 6,145
    Rank: Level 1

    Hi Adrian,

    Is your issue resolved?

    Thank you,

    0

You must be logged in to reply to this topic.

CONTACT US

Please ask IT administration questions in the forum. Any other messages are welcome.

Sending
© 4sysops 2006 - 2017

Log in with your credentials

or    

Forgot your details?

Create Account