I am currently working on PS App Deployment Toolkit for few of my applications to be deployed. This has almost all the functions that we may possibly think of when comes to deploying the applications in interactive mode. The built in function to check for powerpoint presentation mode has been very useful. Similarly, I would like to check if the Users are presenting their screen. We certainly DO NOT want to interrupt Users with interactive windows and popups during their presentation time.
Any help would really be appreciated. Thanks much!
extract the lyncsdk.exe using winzip
extract lyncsdk86.msi (we are using Office 32-bit): msiexec /a lyncsdk86.msi /qb /TARGETDIR=c:\Temp
Copy from TARGETDIR\FILES\Program Files\Microsoft Office 2013\LyncSDK\Assemblies\Desktop the files Microsoft.Lync.Model.dll & Microsoft.Office.Uc.dll to your Toolkit’s SupportFiles directory
Also create a Test-LyncPresentation.ps1 script in the SupportFiles directory
<pre class=“brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”>
function Get-ScriptDirectory
{
<#
.SYNOPSIS
Get-ScriptDirectory returns the proper location of the script.
.OUTPUTS
System.String
.NOTES
Returns the correct path within a packaged executable.
In Toolkit Extensions I have the following script:
<pre class=“brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”>
Function Test-LyncPresentation_EY
{
<#
.SYNOPSIS
Tests wether user is presenting in a Lync/Skype meeting.
.DESCRIPTION
Tests wether user is presenting in a Lync/Skype meeting.
.EXAMPLE
Test-LyncPresentation
.NOTES
This needs to run as user in order to detect if a Lync/Skype meeting is in progress
#>
[CmdletBinding()]
Param (
)
Begin
{
## Get the name of this function and write header
[string]${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -CmdletBoundParameters $PSBoundParameters -Header
}
Process
{
Write-Log -Message 'Check if Lync is in running in presentation mode...' -Source ${CmdletName}
If ((Get-Process -Name lync -ErrorAction SilentlyContinue).Count -gt 0)
{
$LyncResult = Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & '$dirSupportFiles\Test-LyncPresentation.ps1'; Exit `$LastExitCode }" -RunLevel LeastPrivilege -Wait -PassThru
}
Else
{
$LyncResult = 3
}
switch ($LyncResult)
{
'1' {
Write-Log -Message "Detected that Lync is in Presentation mode." -Source ${CmdletName}
[nullable[boolean]]$IsLyncPresenting = $true
}
'2' {
Write-Log -Message "Detected that Lync is not in Presentation mode." -Source ${CmdletName}
[nullable[boolean]]$IsLyncPresenting = $false
}
'3' {
Write-Log -Message 'Lync application is not running.' -Source ${CmdletName}
[nullable[boolean]]$IsLyncPresenting = $false
}
default
{
Write-Log -Message "Failed check to see if Lync is running in Presentation mode." -Severity 3 -Source ${CmdletName}
[nullable[boolean]]$IsLyncPresenting = $null
}
}
}
End
{
Write-Output -InputObject $IsLyncPresenting
Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -Footer
}