+ Post New Thread
Results 1 to 4 of 4
Cloud Services Thread, Office 365 Powershell command, not doing what I expect in Technical; Help! I am running the following command when connected to MSOnline Get-MsolUser | Where-Object {$_.isLicensed -eq "FALSE"} This returns 230 ...
  1. #1

    Join Date
    Jul 2009
    Location
    Staffs
    Posts
    76
    Thank Post
    10
    Thanked 9 Times in 7 Posts
    Rep Power
    12

    Office 365 Powershell command, not doing what I expect

    Help!

    I am running the following command when connected to MSOnline

    Get-MsolUser | Where-Object {$_.isLicensed -eq "FALSE"}

    This returns 230 users (all of my users)

    If I run the same command with FALSE (i.e not licensed), I get....... 230 users (all of my users)

    See screen shotUntitled.png

    Any ideas? I don't understand how I can get the same answer on both queries.

  2. #2

    AngryTechnician's Avatar
    Join Date
    Oct 2008
    Posts
    3,730
    Thank Post
    698
    Thanked 1,210 Times in 761 Posts
    Rep Power
    394
    My PowerShell isn't great but I think you want this:

    Code:
    Get-MsolUser | Where-Object {$_.isLicensed -eq $false}
    More info about why it's not bombing out by using the wrong type of 'false': Understanding Booleans in PowerShell - TechNet Articles - United States (English) - TechNet Wiki

  3. Thanks to AngryTechnician from:

    mbedford (7th June 2013)

  4. #3

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,037
    Thank Post
    160
    Thanked 908 Times in 712 Posts
    Blog Entries
    3
    Rep Power
    270
    Hi,

    Yes the following command you need is as follows:

    Get-MsolUser -all | Where-Object {$_.isLicensed -eq $false} | Export-Csv C:\UnlicensedUsers.csv
    -all = means it will completed the entire request

    $false = displays the unlicensed users

    Export-Csv = Puts it in a file for you, save having it listed in the powershell console.

    That article above is handy to read also that AngryTechnician Linked you too.

    James.

  5. Thanks to EduTech from:

    mbedford (7th June 2013)

  6. #4

    Join Date
    Jul 2009
    Location
    Staffs
    Posts
    76
    Thank Post
    10
    Thanked 9 Times in 7 Posts
    Rep Power
    12
    Thanks both, the moment i read the solution I understood completely. I have been working with PowerShell for a few months now so you would think I would have realised that. Strange thing is, i took that command text straight from a technet post

    Thanks
    Mike

SHARE:
+ Post New Thread

Similar Threads

  1. Office 365 - Not a good start
    By Michael in forum Cloud Services
    Replies: 24
    Last Post: 26th October 2012, 09:32 AM
  2. Replies: 2
    Last Post: 21st October 2012, 04:21 PM
  3. Where do I sign up for office 365?
    By ihaveaproblem in forum Cloud Services
    Replies: 4
    Last Post: 24th September 2012, 01:10 PM
  4. [Website] I was doing what speed officer?
    By creese in forum Jokes/Interweb Things
    Replies: 0
    Last Post: 20th July 2010, 01:55 PM
  5. Sophos - Not doing what I expect it to...
    By Arcolite in forum Windows
    Replies: 5
    Last Post: 11th January 2008, 02:45 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
  •