AudioCodes IP Phone Powershell Module

PowerShell Module

The following example configuration can be used on a Audiocodes IP Phone with Skype for Business (Server and Online).

<div class="card-header"> set-ippfactorydefault.ps1 is hosted on github  [<a href="https://github.com/shanehoey/ipphones/blob/master/scripts/set-ippfactorydefault.ps1">view</a>] [<a href="https://raw.githubusercontent.com/shanehoey/ipphones/master/scripts/set-ippfactorydefault.ps1">raw</a>]
</div>
<div class="card-body">
    <pre class="pre-scrollable">
        <code class="text-primary">

Recommended Installation Method

Install the IP Phone Module

To install the IP Phone module with PowerShellGet

Install-Module -Name ipphone -Scope CurrentUser

Installation

Update the IP Phone Module

To update the IP Phone module with PowerShellGet

Install-Module -Name ipphone -Scope CurrentUser

List Commands

List all commands in IP Phone Module

Get-Command -Module ipphone

Checking SSL Trust

By default your computer may not trust the SSL certifcate on the IP Phone, this command will check if your computer trusts the IP Phone SSL certificate

test-ipphoneTrustCertPolicy -ipphone 172.16.18.131

if the IP Phone is not trusted modify the trust cert policy (powershell core you use -skipcertificatecheck instead). Any changes are only valid for the current shell, if you close powershell the TrustAllCertPolicy will be reverted

set-ipphoneTrustAllCertPolicy

Example Usages

Login Single IP Phone

The following example will log an AudioCodes IPP Phone on remotely.

  • ipphone Is the IP Address or FQDN of the IP Phone you want to log onto
  • ippcredential Is the Credential(username/password) of the IP Phone (default is admin/1234)
  • sipaddress Is the sip address of the user that you want to log the phone in as
  • sipcredential Is the credential(username/password) of the user that you want to log the phone in as
set-ipphoneTrustAllCertPolicy

$ipphone = “172.16.18.135”
$ippcredential = get-credential -Message "Credential" -UserName "admin"

$sipaddress = “shane@shoey.xyz”
$sipcredential  = get-credential -Message "Credential" -UserName $sipaddress

$websession  = new-ipphonewebsession -ipphone $ipphone
connect-ipphone -ipphone $ipphone -credential $ippcredential -websession $websession 
Invoke-ipphoneLoginUser -ipphone $ipphone -sipcredential $sipcredential -sipaddress $sipaddress -websession $websession

Logon Single IP Phone (using Office 365 CLoud login)

The following example will log an AudioCodes IPP Phone on remotely.

  • ipphone Is the IP Address or FQDN of the IP Phone you want to log onto
  • ippcredential Is the Credential(username/password) of the IP Phone (default is admin/1234)

set-ipphoneTrustAllCertPolicy

$ipphone = “172.16.18.135”
$ippcredential = get-credential -Message "Credential" -UserName "admin"

$websession  = new-ipphonewebsession -ipphone $ipphone
connect-ipphone -ipphone $ipphone -credential $ippcredential -websession $websession 
Invoke-ipphoneLoginUser -ipphone $ipphone -cloud -websession $websession

get-ipphonestatus -ipphone $ipphone -websession $websession 

Logoff Single IP Phone

The following example will logoff the current logged in user of an AudioCodes IPP Phone.

  • ipphone Is the IP Address or FQDN of the IP Phone you want to log onto
  • ippcredential Is the Credential(username/password) of the IP Phone (default is admin/1234)
set-ipphoneTrustAllCertPolicy

$ipphone       =  “172.16.18.135”
$ippcredential = get-credential -Message "Credential" -UserName "admin"

$websession  = new-ipphonewebsession -ipphone $ipphone
connect-ipphone -ipphone $ipphone  -credential $ippcredential -websession $websession
Invoke-ipphoneLoginUser -ipphone $ipphone -logoff -websession $websession

Scan Subnet and Log IP Phones using a JSON file

The following example will log an AudioCodes IPP Phone based on a json file. It will scan the subnet given and only logon to the phone if the MAC address matches

The following information is required in the json file

  • mac is the mac address of the IP Phone in format 00-00-00-00-00-00
  • username is the username of the account you want to log the phone in as (username@domain or domain\username)
  • sipaddress is the sip address is the credentials of the user that you want to log the phone in as
  • password is the password of the Users

Storing Password in JSON file

If you are storing the password do not use cleartext instead use securestring and copy the resulting string into the json file.

"mypassword" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString

The password is only valid when logged in as the same user/same password as it was created with.

Storing Clear Text Password in JSON file

Do Not do this! Storing passwords in a text file in clear text is a security risk, do not do this! If you must do this then use the -cleartext parameter.

Convert CSV to Json

if you prefer to store the file in csv format you can do the following to convert it into JSON prior to importing it.

get-content .\phones.csv | ConvertFrom-Csv | convertto-json | Out-File .\phones.json

JSON FILE

[
  {
    "mac": "00-90-8F-00-00-00",
    "username": "shane@shoey.example",
    "sipaddress": "shane@shoey.example",
    "password": null
  },
  {
    "mac": "00-90-8F-00-00-00",
    "username": "debra@shoey.example",
    "sipaddress": "debrab@shoey.example",
    "password": null
  }
]

Download Script

NOTE: This script is currently seperate to the module and you must download seperatly

Link to Script

./invoke-ipphoneScanLogin.ps1 -subnet "172.16.18." -first 131 -last 132 -file .\PRIVATE-phones.json

Scan Subnet and perform Maintenance Actions

Download Script

NOTE: This script is currently seperate to the module and you must download seperatly

Link to Script

# Reboot ALL Phones in subnet 
./invoke-ipphoneScanMaintenanceTask.ps1 -subnet "172.16.18." -first 131 -last 132

# Factory Default ALL Phones in subnet 
./invoke-ipphoneScanMaintenanceTask.ps1 -subnet "172.16.18." -first 131 -last 132 -FactoryDefault

#Log Off Phones ALL Phones in subnet
./invoke-ipphoneScanMaintenanceTask.ps1 -subnet "172.16.18." -first 131 -last 132 -logoff

        </code>
    </pre>
</div>