Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ShoreTel Communicator PowerShell Modules

    ShoreTel Communicator PowerShell Modules 0.7






    Use of the attached powershell code is completely at your own risk.

    Compatiblity
    I have tested these modules on ShoreTel 14.2 I do not guarantee that they will work 100% in your environment.
    They will probably function on most versions above ShoreTel v12 excluding the ShoreTel Director modules that will likely stop working after the UI revamp coming with v15.

    What can it do?
    New-ShoreTel_Session - Authenticate and create session object (AD & plain text)
    Send-ShoreTel_CommunicatorLogin - Login as a communicator client
    New-ShoreTel_Call - Make a call
    Stop-ShoreTel_Call - Drop a call
    Set-ShoreTel_CallHandlingMode - Set call handling mode
    Set-ShoreTel_PhoneAssignment - Assign extension to external number and send extension back home
    Search-ShoreTel_Contacts - Search ShoreTel contacts
    Get-ShoreTel_Calls - List active calls
    Get-ShoreTel_VMList - Get list of voice mails
    Get-ShoreTel_VMFile - Download a ShoreTel voice mail as a wave file
    Send-ShoreTel_PlayVM - Play a ShoreTel vm
    Set-ShoreTel_VMSubject - Set ShoreTel vm subject
    Move-ShoreTel_VM - Move ShoreTel vm to a different folder (move to folder 3 to delete)
    Clear-ShoreTel_DeletedVM - Clear deleted vm folder
    Start-ShoreTel_CallRecord - Record an active call
    Stop-ShoreTel_CallRecord - Stop a call recording
    Get-ShoreTel_CallHistory - Get call history
    Send-ShoreTel_CallDigit - Send digit over a call
    Set-ShoreTel_WorkgroupLogin - Login to ShoreTel workgroups
    Set-ShoreTel_WorkgroupLogout - Logout of ShoreTel workgroups
    Set-ShoreTel_WorkgroupEnterWrap - Enter wrap state in ShoreTel workgroups

    Remove-ShoreTelDirectorUser - Remove a user from the ShoreTel Director
    Get-ShoreTelDirectorUser - Get details about a user from ShoreTel Director

    Requires agsXMPP.dll (See readme)
    New-XMPP_Session - Authenticate and create XMPP session object, agsXMPP doesn't support kerberos so no windows authentication pass-through
    Set-XMPP_Presence - Set your presence status and status note

    Download from BitBucket
    Last edited by crimson.falconer; 07-10-2015, 12:56 AM.

  • #2
    Updated with new functions:

    Send-ShoreTel_CallDigit - Send digit over a call
    Set-ShoreTel_WorkgroupLogin - Login to ShoreTel workgroups
    Set-ShoreTel_WorkgroupLogout - Logout of ShoreTel workgroups
    Set-ShoreTel_WorkgroupEnterWrap - Enter wrap state in ShoreTel workgroups

    Comment


    • #3
      Is it posible to getevents?

      I try the function that is in the shoretel module but i cant get it to work. Then i can see incoming phonecalls

      Edit: and getting the status? (i think you can see it in the flags that you get back when you login)

      Comment


      • crimson.falconer
        crimson.falconer commented
        Editing a comment
        You need to subscribe to events first or cause something that would cause an event to happen like attempting to download a voicemail file.

        If you open up fiddler on your pc then login to web communicator you'll see a subscribe json function is called at the start subscribing to many events I was playing around with this at one stage but never completed it.

    • #4
      These are a great help! Well Done!

      Any chance of adding a few more Gets...like Get-ShoreTel_CallHandlingMode - Get current call handling mode
      and maybe Get-ShoreTel_PhoneAssignment - Gets current assigned extension. Both of these would give me everything I need.

      Comment


      • crimson.falconer
        crimson.falconer commented
        Editing a comment
        I've added two functions that might do what you requested.

        Get-ShoreTel_ExtensionProperties returns an array that holds the details you want regarding phone assignment
        Get-ShoreTel_CallHandlingMode returns the current call handling mode

    • #5
      Updated with new functions:

      Get-ShoreTel_ExtensionProperties - Returns data related to phone assignment and extension status
      Get-ShoreTel_CallHandlingMode - Returns the current call handling mode
      Get-ShoreTel_VMAccessibleMailboxes - Returns the mailboxes accessible by the current user

      Comment


      • #6
        Thanks for the update. Get-ShoreTel_CallHandlingMode works perfectly, Thanks again.
        Get-ShoreTel_ExtensionProperties, doesn't seem to include the phone number (extension) of the phone. Is that possible?

        Thanks

        Comment


        • crimson.falconer
          crimson.falconer commented
          Editing a comment
          Oh if you just want the current users extension that is stored in the session details. $session.UserDN

      • #7
        These are great... but being a bit of a noob, can someone tell me the PS commands to connect to the ShoreTel system in order to then use the above commands? ;-)

        Comment


        • #8
          There are some example scripts included in the downloads.

          Make sure your have set the execution policy for powershell scripts on your machine to RemoteSigned, Unrestricted or Bypass.

          Code:
          # Enter Shoretel server ip address or computer name below (make sure you keep the double quotes around your string
          $server = "x.x.x.x"
              
          # This creates a session using windows authentication to login
          $session = New-ShoreTel_Session -shoretelServer $server -windowsAuth $true
          
          # Check session authenticated
          if($session.Authenticated)
          {
              # Login session to web communicator
              Send-ShoreTel_CommunicatorLogin -session $session
              if($session.LoggedIn)
              {
                  # Put your commands in here
                  # For example the below displays an arroy with the call handling mode
                  Get-ShoreTel_CallHandlingMode -session $session
              }
              else
              {
                  Write-Host "Unable to login to shoretel web communicator"
              }
          }
          else
          {
              Write-Host "Unable to authenticate to shoretel"
          }

          Comment


          • #9
            There is some big changes in v0.5

            There is no need to call Send-ShoreTel_CommunicatorLogin after creating a session anymore this function is called automatically when a session is created, you should remove calls to this function from your existing scripts.

            Each function can now be provided with a server name, user, password and windowsauth (true or false) instead of a session object to allow easier adhoc use.
            I'd suggest only using this method if you're calling a single function in your script as using a session object as before will be much faster if you're calling more than a single function.

            This:
            Code:
                $session = New-ShoreTel_Session -shoretelServer $server -windowsAuth $true
                Send-ShoreTel_CommunicatorLogin -session $session
                Set-ShoreTel_CallHandlingMode -CHM $CHM -session $session
            could be shortened to this
            Code:
                Set-ShoreTel_CallHandlingMode -CHM $CHM -shoretelServer $server -windowsAuth $adauth -user $user -pass $pass
            Some other minor fixes were also applied.

            Comment


            • #10
              Hello everyone, newbie here...We use shoretell in our environment right now, having over 1000 users can get very complicated when removing term users. is there a power shell command that I can add to a script to delete users from shoretel? any help will be appreciated...

              Thanks

              Comment


              • #11
                Hi Will

                The powershell scripts I created only really automated client functionality via a json api, what you're asking about is to do with the ShoreTel Director side of things a different website built on xml it's also a bit more dangerous.

                But I figured I'd give it a go.

                I've created a very basic module to login to ShoreTel director and remove a user as a test (please be very careful you are getting into areas that can cause major problems if you don't be careful).

                There is no way to check if the command actually succeeded and it seems to return the same xml regardless of success or fail.

                Link to download the script from bitbucket is at the top of the page.
                Last edited by crimson.falconer; 09-08-2014, 01:13 AM.

                Comment


                • #12
                  ShoreTelPS 0.6.2
                  Remove-ShoretelDirectorUser function added error checking, checks if extension actually exists before deletion, returns error from shoretel director if unsuccessful
                  Added Get-ShoreTelDirectorUser function to check if extension exists before deletion.

                  Comment


                  • #13
                    Thanks for your help...I'll give it a try

                    Comment


                    • #14
                      Thank you again for making these PowerShell modules available, they have been a great help! We use the Get-ShoreTel_CallHandlingMode from a program on each user's desk and it works great.

                      The users have requested the ability to also update their Instant Messenger Status note field. Is this a possibility via PowerShell?

                      Thanks

                      Comment


                      • #15
                        Originally posted by btgrant View Post
                        Thank you again for making these PowerShell modules available, they have been a great help! We use the Get-ShoreTel_CallHandlingMode from a program on each user's desk and it works great.

                        The users have requested the ability to also update their Instant Messenger Status note field. Is this a possibility via PowerShell?

                        Thanks
                        Glad to hear they're getting used.

                        I can add pretty much anything the web client can do but the web client doesn't support any of the IM connectivity so I could write the modules but it would essentially be writing them for OCS/Lync or an SA-100.

                        How hard it is to setup depends on what IM server type you're using SA-100 or OCS/Lync

                        - If you're using a OCS/Lync server you can use Microsoft developed modules to set IM status https://msdn.microsoft.com/en-us/lib...ice.14%29.aspx

                        - If you're using the SA-100 conferencing system it uses some form of XMPP. I played around with for a while but never finished code is included in the repo but you'll need to download agsXMPP.dll and point it to the correct place and probably setup some packet capturing to see what ShoreTel Communicator is using to set IM status

                        - Client automation using AutoIT, windows APIs

                        Comment

                        Working...
                        X