Check OCS/Lync enabled AD user with PowerShell

The security is important; working for a huge company sometimes causes problems. You get less right, because of the security. If you a normal user, and you would like to check if one of the user enabled for OCS without Admin rights or Universal Server Administrator right. A normal domain user can check it, because the AD readable for all AD users.

Here is my script, all line commented.


#set the argument

#Usage: ./Check_if_OCS_enabled.ps1 <User Identity>

Param (

[string]$Identity

)

&nbsp;

#PowerShell AD module needed

Import-Module ActiveDirectory

&nbsp;

#get OCS SIP URI of the user

$a = get-aduser -filter { ObjectClass -eq "user" -and SamAccountName -eq $Identity } -property msRTCSIP-PrimaryUserAddress

&nbsp;

#if the SIP URI empty, the user not enabled for OCS

If ($a."msRTCSIP-PrimaryUserAddress" -ne $null)

{Write-Host "Enabled for OCS"}

Else

{Write-Host "Not enabled for OCS"}
 

That’s ALL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s