Powershell script to get all disabled users and do sometingh with the results

Posted on 2011-10-21
Last Modified: 2012-05-12
Hi Guys,

I'm trying to list all disabled users in my org and then disable Lync Server for that users if it is enabled.

I tried the following command, but it returns an error:

Get-QADUser -Disabled | Disable-CsUser

Then I tried the following command:

Get-QADUser -Disabled | ForEach-Object {$user = "domain\" + $_.samAccountName};{Get-CsAdUser -Identity $user -Filter {Enabled -eq $True} | Disable-CsUser}

It appears to be working, but there is no output that can confirm to me that it did disabled that users. I need to open each user account to make sure lync has been disabled.

Could you please tell me how to issue the above command to get an output to confirm the users had been disabled for sure?


Rodrigo Garcone
Question by:garconer
    1 Comment
    LVL 6

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Why would I want to create a function for tracking messages? I am glad you asked. As with most monotonous/routine tasks, human error tends to creep in after doing the same task over and over again. By creating a function, you load the function once…
    You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
    This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
    This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now