Select Page

Get-CsActiveCalls – Get Lync Mediation server active calls with powershell

Get-CsActiveCalls

Hi,

This is a simple script you can use to see which server has active calls (mediation).

This uses the Get-CsWindowsService cmdlet to get the RTCMEDSRV values. This can be useful if you need to restart a server.

If you need only one server, you can also use this command :

Get-CsWindowsService -Name RTCMEDSRV | select activitylevel

To launch the function, just write the function name followed by the computername :

Get-CsActiveCalls computer01,computer02,computer03,computer04

This will show you the active calls like in the picture.

A few modifications : powershell seems to keep all values from before, so we just clear the values after showing the object with Clear-Item.

Communication Server versions tested
Office Communication Server 2007
Microsoft Lync Server 2010 OK
Microsoft Lync Server 2013 OK

Here is the script :

 


function Get-CsActiveCalls {
	param (
        [parameter(Mandatory=$false)][array]$Computer = $env:computername
    )
 	$BeforeErrorActionPreference=$ErrorActionPreference
	$BeforeProgressPreference = $ProgressPreference

	$ErrorActionPreference="SilentlyContinue"
	$ProgressPreference = "SilentlyContinue"
	cls
	
	$DateTimeDone = (Get-Date).tostring()
	Write-Host "Calls state on " -NoNewline
	Write-Host $DateTimeDone -ForegroundColor Green
	
    foreach ($PC in $Computer) {
 
        $x = Get-CsWindowsService -Name RTCMEDSRV -ComputerName $PC | select -expandproperty activitylevel
        
		$obj = New-Object PSObject
        $obj | Add-Member NoteProperty "Computer" $PC #.ToString()
 
        $findOut = $x -match '.*Current Outbound Calls=(\d+),.*'
        if ($findOut) {
            $outbound = $matches[1]
            $obj | Add-Member NoteProperty "Outbound Calls" $outbound #.ToString()
        }
 
        $findIn = $x -match '.*Current Inbound Calls=(\d+),.*'    
        if ($findIn) {
            $inbound = $matches[1]
            $obj | Add-Member NoteProperty "Inbound Calls" $inbound #.ToString()
        }
		
		$obj
    }
	
	Clear-Item $matches
	Clear-Item $obj
	Clear-Item $x
	Write-Host "Press any key to continue ..." -ForegroundColor yellow
	$KeyDown = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
	
	$ErrorActionPreference=$BeforeErrorActionPreference
	$ProgressPreference=$BeforeProgressPreference
}
Get-CsActiveCalls computer01,computer02,computer03,computer04

NetApp Powershell Manager

Hi there,

Another script I’ve been developping this week : Netapp Powershell Manager. Download here

If you want to launch it from a Windows client, ensure you have the RSAT from Microsoft installed on your computer, and that you are logged as a domain dns admin.

By launching the netappVserverManager.ps1 script, you see the front page as seen on the image from left.

You can choose between Cluster mode or 7-mode, but actually only the cluster mode works (7-mode will come soon).

The program check the version of Windows and let you go further if you’re running Windows 7 or 2008 R2. If not, the progam show an error and end.

If the programm cannot load the dataontap module, it will prompt you for download the powershell toolkit MSI. This will open an IE instance with the link to download the toolkit. Login with your netapp credentials, accept the eula and you’re clear to download the MSI!

After having installed the msi, relaunch the script. From there, you’ll be able to go further to the server connection process.

Enter the server IP or name, the password, and once you are connected, you’ll see the menu as view in the picture from the right.

Actually, the script can only show you some information and (most useful) bulk add dns hosts (A) records into the DNS server.

I’ll come soon with new functions. Don’t hesitate to leave a comment/suggestion.

Cheers,

Karl

 

 

Fenestrae Faxination Server Bulk User Import on Active Directory – Version 1.0

Fenestrae Bulk

Fenestrae Bulk

Hi all,

I just finished creating a useful script to bulk import Fenestrae Users into Active Directory.

This script only activates the FAX part of fenestrae, I will add the ability to set SMS, MMS and all features on Active Directory soon.

Download here : fenestraeCSV

$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
#Requires -Version 2.0
[string] $FilenameTranscript = $MyInvocation.MyCommand.Name + " " + (hostname)+ " {0:yyyy-MM-dd hh-mmtt}.log" -f (Get-Date)
Start-Transcript -path .\$FilenameTranscript | Out-Null
$error.clear()

clear

Write-Host "##########################################################################"
Write-Host "#     Fenestrae Bulk user activation                                     #"
Write-Host "#                                                                        #" 
Write-Host "##########################################################################" 
Write-Host "#   Author      : Karl Bustamante                                        #" 
Write-Host "#   Date        : 08.02.2013                                             #" 
Write-Host "#   Version     : 1.0                                                    #" 
Write-Host "#   Comment     : This program is used to activate bulk users for        #"
Write-Host "#                 Fenestrae Faxination Server                            #" 
Write-Host "#   Modified by :                                                        #"
Write-Host "#   Date        :                                                        #"
Write-Host "#   Comment     :                                                        #"
Write-Host "#                                                                        #" 
Write-Host "##########################################################################" 
Write-Host " "

Write-Host "Press any key to continue ..." -ForegroundColor yellow
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

function criticalError{
Write-Host "Error" -ForegroundColor black -backgroundcolor red
Stop-Transcript
Write-Host "Press any key to continue ..." -ForegroundColor yellow
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit
}

#Variables

#Strings
$strCSVPath = ".\fenestraeusers.csv"			# CSV File path

# Detect correct OS here and exit if no match (we intentionally truncate the last character to account for service packs)
Write-Host "System Version (OS) : " -NoNewLine
Write-Host (Get-WMIObject win32_OperatingSystem).Version -NoNewLine

if ((Get-WMIObject win32_OperatingSystem).Version -notmatch '6.1.760'){
	Write-Host "..............................[    ERROR   ]" -ForeGroundColor red
	Write-Host "`nThis script requires a version of Windows Server 2008 R2, which this is not. Exiting...`n" -ForegroundColor Red
	Stop-Transcript
	Write-Host "Press any key to continue ..." -ForegroundColor yellow
	$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
	Exit
} #end OS detection
Write-Host "..............................[     OK!    ]" -ForeGroundColor Green

# checking if csv path is ok
Write-Host " - Checking if CSV '$strCSVPath' is available " -NoNewLine 
if(Test-Path -PathType leaf -Path $strCSVPath)
{
    Write-Host ".....[     OK!    ]" -ForeGroundColor green
	Write-Host " - Reading data in $strCSVPath" -NoNewLine
	$csvUsers = Import-Csv -path '.\fenestraeusers.csv' -delimiter ';'
	Write-Host ".....................[     OK!    ]" -ForeGroundColor green
}
else
{
	Write-Host ".....[    ERROR   ]" -ForeGroundColor red
	Write-Error "`nFile not found"
	criticalError
}

# Function to test if AD module is available
Function Get-MyModule { 
	Param([string]$name) 
	if(-not(Get-Module -name $name)) 
	{ if(Get-Module -ListAvailable | Where-Object { $_.name -eq $name }) 
	{ Import-Module -Name $name 
	Write-Host "`nThe"  -NoNewLine
	Write-Host " <$name> "  -ForegroundColor yellow -NoNewLine
	Write-Host "module has been loaded!"

	} 
	else { Write-Host -BackgroundColor Red "`n<$name>" -NoNewLine 
	Write-Host " module has not been loaded " -BackgroundColor Red -ForegroundColor yellow
	criticalError
	}
	} # end if not module 
	else {
		Write-Host "`nThe" -NoNewLine
		Write-Host " <$name> "  -ForegroundColor yellow -NoNewLine
		Write-Host "module is already loaded!" } 
	}
Get-Mymodule -name "ActiveDirectory"

Write-Host "--------------------------------------------------------------------------" -ForegroundColor green
Write-Host "Press any key to continue ..." -ForegroundColor yellow
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host "--------------------------------------------------------------------------" -ForegroundColor green

#Users creation
foreach($User in $csvUsers)
{

$login = $user.samaccountname
$facsimileTelephoneNumber = $user.facsimileTelephoneNumber
$dir = $user.dir
$fenUMOurCSID = $user.fenUMOurCSID
$fenUMAllowChargecodeOverride = $user.fenUMAllowChargecodeOverride
$fenUMAllowCoversheetOverride = $user.fenUMAllowCoversheetOverride
$fenUMAllowedToSendFax = $user.fenUMAllowedToSendFax
$fenUMAllowedToSendFaxInt = $user.fenUMAllowedToSendFaxInt
$fenUMAllowedToSendSms = $user.fenUMAllowedToSendSms
$fenUMAllowedToSendSmsInt = $user.fenUMAllowedToSendSmsInt
$fenUMAllowOurCSIDOverride = $user.fenUMAllowOurCSIDOverride
$fenUMAllowSMSTemplateOverride = $user.fenUMAllowSMSTemplateOverride
$fenUMCoversheet = $user.fenUMCoversheet
$fenUMFileformat = $user.fenUMFileformat
$fenUMMailTemplate = $user.fenUMMailTemplate

	Write-Host "--------------------------------------------------------------------------" -ForegroundColor cyan
	Write-Host " samAccountName         : $login" -ForegroundColor cyan
	Write-Host " FAX Number             : $facsimileTelephoneNumber" -ForegroundColor cyan
	Write-Host " CSID                   : $fenUMOurCSID" -ForegroundColor cyan
	Write-Host " DIR Number proxyaddress: $dir" -ForegroundColor cyan
	Write-Host " Coversheet             : $fenUMCoversheet" -ForegroundColor cyan
	Write-Host " File Format            : $fenUMFileformat" -ForegroundColor cyan
	Write-Host " Mail Template          : $fenUMMailTemplate" -ForegroundColor cyan
	Write-Host " ChargeCode Override    : $fenUMAllowChargecodeOverride" -ForegroundColor cyan
	Write-Host " CoversheetOverride     : $fenUMAllowCoversheetOverride" -ForegroundColor cyan
	Write-Host " Send FAX               : $fenUMAllowedToSendFax" -ForegroundColor cyan
	Write-Host " Send FAX International : $fenUMAllowedToSendFaxInt" -ForegroundColor cyan
	Write-Host " Send SMS               : $fenUMAllowedToSendSms" -ForegroundColor cyan
	Write-Host " Send SMS International : $fenUMAllowedToSendSmsInt" -ForegroundColor cyan
	Write-Host " CSID Override          : $fenUMAllowOurCSIDOverride" -ForegroundColor cyan
    Write-Host " SMS Template Override  : $fenUMAllowSMSTemplateOverride" -ForegroundColor cyan

	Write-Host "$login..................................................[" -NoNewLine
	Write-Host "   Creating   " -ForegroundColor yellow -NoNewLine
	Write-Host "]" -NoNewLine

	if ($facsimileTelephoneNumber -ne ""){
		$a = "Set-ADUser " + $login + " -Replace @{facsimileTelephoneNumber='" + $facsimileTelephoneNumber + "'}"
		Invoke-Expression $a
	}
	if ($fenUMAllowChargecodeOverride -ne ""){
		$b = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowChargecodeOverride'='" + $fenUMAllowChargecodeOverride + "'}"
		Invoke-Expression $b
	}
	if ($fenUMAllowCoversheetOverride -ne ""){
		$c = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowCoversheetOverride'='" + $fenUMAllowCoversheetOverride + "'}"
		Invoke-Expression $c
	}
	if ($fenUMAllowedToSendFax -ne ""){
		$d = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowedToSendFax'='" + $fenUMAllowedToSendFax + "'}"
		Invoke-Expression $d
	}
	if ($fenUMAllowedToSendFaxInt -ne ""){
		$e = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowedToSendFaxInt'='" + $fenUMAllowedToSendFaxInt + "'}"
		Invoke-Expression $e
	}
	if ($fenUMAllowedToSendSms -ne ""){
		$f = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowedToSendSms'='" + $fenUMAllowedToSendSms + "'}"
		Invoke-Expression $f
	}
	if ($fenUMAllowedToSendSmsInt -ne ""){
		$g = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowedToSendSmsInt'='" + $fenUMAllowedToSendSmsInt + "'}"
		Invoke-Expression $g
	}
	if ($fenUMAllowOurCSIDOverride -ne ""){	
		$h = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowOurCSIDOverride'='" + $fenUMAllowOurCSIDOverride + "'}"
		Invoke-Expression $h
	}	
	if ($fenUMAllowSMSTemplateOverride -ne ""){	
		$i = "Set-ADUser " + $login + " -Replace @{'fen-UM-AllowSMSTemplateOverride'='" + $fenUMAllowSMSTemplateOverride + "'}"
		Invoke-Expression $i
	}	
	if ($fenUMCoversheet -ne ""){		
		$j = "Set-ADUser " + $login + " -Replace @{'fen-UM-Coversheet'='" + $fenUMCoversheet + "'}"
		Invoke-Expression $j
	}
	if ($fenUMFileformat -ne ""){		
		$k = "Set-ADUser " + $login + " -Replace @{'fen-UM-Fileformat'='" + $fenUMFileformat + "'}"
		Invoke-Expression $k
	}
	if ($fenUMMailTemplate -ne ""){		
		$l = "Set-ADUser " + $login + " -Replace @{'fen-UM-MailTemplate'='" + $fenUMMailTemplate + "'}"
		Invoke-Expression $l
	}
	if ($dir -ne ""){		
		$m = "Set-ADUser " + $login + " -Add @{proxyAddresses = '" + $dir + "'}"
		Invoke-Expression $m
	}
	if ($fenUMOurCSID -ne ""){		
		$n = "Set-ADUser " + $login + " -Replace @{'fen-UM-OurCSID'='" + $fenUMOurCSID + "'}"
		Invoke-Expression $n
	}	

	Write-Host "`b`b`b`b`b`b`b`b`b`b`b`b`b`b     OK!" -ForegroundColor green -NoNewLine
	Write-Host "     ]"
}

Write-Host "--------------------------------------------------------------------------" -ForegroundColor green
Stop-Transcript
Write-Host "--------------------------------------------------------------------------" -ForegroundColor green
Write-Host "Press any key to exit ..." -ForegroundColor yellow

$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Lync Server 2010 – Beep before call

Hi all,

As per usual, this is a network issue. You can use Microsoft Network Monitor with port and IP filters to check connexions.

Normally, the issue is the following :

The client is making an outbound call, the call has 3 ways to process and will try the ways as follow :

  1. Internet (Edge) – The call ask the EDGE if someone with the following sip is connected trough him.
  2. PSTN – Your PSTN Gateway
  3. Voicemail – Your UM Exchange server

For any network reason (Switch, Router,Firewall,…), the client can reach the edge, but the edge can’t reach the client. This is causing several beeps before the call really begin.

Hope this helps!