How to send a skype message using Powershell?

Powershell from Microsoft used to send a automated message in skype for business messenger.

Lync 2013 SDK installed in the target machine and used the Microsoft.Lync.Model.DLL available in the program files. API’s available in the DLL has been utilized to trigger all the required functionalities such as send a message, join a meeting room, join a conference room etc

Download and install the powershell using the below URL;

https://support.office.com/en-us/article/Download-and-install-Windows-PowerShell-3-0-d739cd71-3c18-42ea-879f-b408bf53b1f4

To manage the Lync 2013 SDK in the windows x64 bit machine; Refer the below URL;

https://msitpros.com/?p=3570

Please find the below code snippet to trigger an automated message using the powershell script and refer the below video to know about the script functionality in detail;

$assemblyPath = “C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.DLL”

Import-Module $assemblyPath

$IMType = 1

$PlainText = 0

$cl = [Microsoft.Lync.Model.LyncClient]::GetClient()

$conv = $cl.ConversationManager.AddConversation()

$username = “gopikannamailbox@gmail.com”

$getuser = $cl.ContactManager.GetContactByUri($username)

$null = $conv.AddParticipant($getuser)

$msg = New-Object “System.Collections.Generic.Dictionary[Microsoft.Lync.Model.Conversation.InstantMessageContentType,String]”

$msg.Add($PlainText, “Test message by robo using powershell”)$m = $conv.Modalities[$IMType]

$null = $m.BeginSendMessage($msg, $null, $msg)

For more scripts to automate skype for business, please use my github repo;

https://github.com/gopekanna/test_Skype_PeertoPeer_Instant

https://github.com/gopekanna/test_Skype_AudioVideo_Sharing

 

ps_logo

3 thoughts on “How to send a skype message using Powershell?

  1. My script is not working. Is it mandatory to install Lync 2013 ??? Actually I installed 32bit Lync instead of 64bit and now I am not able to uninstall it . What should I do ???

    Like

    1. You should install 32-bit only and the same assembly will be available in the below location
      C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.DLL

      Like

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 )

Connecting to %s