Microsoft Lync 2013 Powershell “no prompt” FIX.

Working with Microsoft Lync on a daily basis, you begin to appreciate all the subtleties of merging Microsoft “quirks” with a phone system.  Although Lync is MUCH more then just a plain old PBX, its intention to replace that device for businesses leave much to be desired for those that enjoyed the old days of a Nortel box, running for years without any intervention, rebooting, or random quirkiness that only the awesomeness of a Microsoft server can bring to the table.

While working on a Lync environment for a customer I noticed that on 2 of the 3 “Front End” boxes that the Lync Powershell program would go to a black box, with a blinking cursor and never give me a prompt to enter anything.  As a matter of fact, I had to keep going only one Lync FE Server to run all my commands.  Some investigating led me to find what I think is a bug in Windows Server 2012 R2.  As a side note – these machines are virtuals on Hyper-V, and running Lync 2013.

For whatever crazy reason, the Lync Powershell applet icon has incorrect/missing quotations.  By repairing the quotations, the PowerShell applet will run correctly every time.  Here is the interesting part.  Once you fix the icon and “correctly” run a PowerShell window – even a “broken” icon will run correctly after that.  Does that make sense?  Very simply, if you run into this problem, just fix the shortcut properties in the Start Screen “All Apps” list (the arrow at the bottom) and it will work fine after that.  Crazy right?  Here are the details….

To get to see the properties of the icon – go to your Start Screen (“metro”), click the down arrow for “all apps”.  Right click the “Lync Server Management Shell” icon, select “Open Containing Folder”.  Then right click the Lync Server Management Shell icon again and select “Properties”.  The “target” line is the one we are concerned with.

The properties of the icon as installed are: (take special note of the use of single and double quotes):

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command “cd $env:UserProfile; Import-Module ‘C:\Program Files\Common Files\Microsoft Lync Server 2013\Modules\Lync\Lync.psd1’

Note that there isn’t any closing double quote!  By just adding a double quote to the end you might think it would work, but that produces a big red error in the PowerShell window, complaining about the single quote around a file location with a space in it, as you might expect….  So I fixed it like this:

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ‘cd $env:UserProfile; Import-Module “C:\Program Files\Common Files\Microsoft Lync Server 2013\Modules\Lync\Lync.psd1″‘

By putting the double quote around the C:\Program Files….. part and changing the existing double quote to single, and closing it with another single quote at the end, then it works fine and PowerShell will run properly after that.

The crazy part is – even if you go and “break” that shortcut again, setting it back to the way it was initially, it will still work fine after you successfully run it once.  I don’t know for how long, or why, but it works!

Thanks Microsoft – for keeping me on my toes.  Hope it helps someone else that had this problem.  Have a good day!

 

This entry was posted in Uncategorized and tagged . Bookmark the permalink.