Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

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

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
1 Solution

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now