55994b77-d7e4-4a86-8858-e32f7d402b4d
1.2
Param (
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[System.Windows.Forms.ComboBox]$ComboBox,
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
$Items,
[Parameter(Mandatory=$false)]
[string]$DisplayMember,
[switch]$Append
)
if(-not $Append)
{
$ComboBox.Items.Clear()
}
if($Items -is [Object[]])
{
$ComboBox.Items.AddRange($Items)
}
elseif ($Items -is [Array])
{
$ComboBox.BeginUpdate()
foreach($obj in $Items)
{
$ComboBox.Items.Add($obj)
}
$ComboBox.EndUpdate()
}
else
{
$ComboBox.Items.Add($Items)
}
$ComboBox.DisplayMember = $DisplayMember
}
function Load-ListBox
{
<#
.SYNOPSIS
This functions helps you load items into a ListBox or CheckedListBox.
.DESCRIPTION
Use this function to dynamically load items into the ListBox control.
.PARAMETER ListBox
The ListBox control you want to add items to.
.PARAMETER Items
The object or objects you wish to load into the ListBox's Items collection.
.PARAMETER DisplayMember
Indicates the property to display for the items in this control.
.PARAMETER Append
Adds the item(s) to the ListBox without clearing the Items collection.
.EXAMPLE
Load-ListBox $ListBox1 "Red", "White", "Blue"
.EXAMPLE
Load-ListBox $listBox1 "Red" -Append
Load-ListBox $listBox1 "White" -Append
Load-ListBox $listBox1 "Blue" -Append
.EXAMPLE
Load-ListBox $listBox1 (Get-Process) "ProcessName"
#>
Param (
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[System.Windows.Forms.ListBox]$ListBox,
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
$Items,
[Parameter(Mandatory=$false)]
[string]$DisplayMember,
[switch]$Append
)
if(-not $Append)
{
$listBox.Items.Clear()
}
if($Items -is [System.Windows.Forms.ListBox+ObjectCollection])
{
$listBox.Items.AddRange($Items)
}
elseif ($Items -is [Array])
{
$listBox.BeginUpdate()
foreach($obj in $Items)
{
$listBox.Items.Add($obj)
}
$listBox.EndUpdate()
}
else
{
$listBox.Items.Add($Items)
}
$listBox.DisplayMember = $DisplayMember
}
#endregion
$SearchButton_Click={
#TODO: Place custom script here
$buttonConnect.Enabled = $false
$sessionInfo.Text = ""
$sessionListBox.Items.Clear()
$shadowStatusBar.Text = "Checking For Sessions..."
$shadowStatusBar.Update()
$script:session = Get-XASession -AccountDisplayName "vcpi\$($usernameTextBox.text)" -computername $combobox1.SelectedItem.ToString() | ?{$_.state -eq "Active"}
$shadowStatusBar.Text = ""
$shadowStatusBar.Update()
foreach($item in $script:session)
{
$sessionListBox.Items.Add("$($item.servername):$($item.BrowserName):$($item.sessionid)")
}
}#end SearchButton_Click
$combobox1_SelectedIndexChanged={
#TODO: Place custom script here
$buttonConnect.Enabled = $false
$usernameTextBox.Text = $null
$sessionInfo.Text = ""
$sessionListBox.Items.Clear()
$usernameTextBox.Focus()
}#end combobox1_SelectedIndexChanged
$sessionListBox_SelectedIndexChanged={
#TODO: Place custom script here
$buttonConnect.Enabled = $false
$sessionInfo.ForeColor = 'Black'
$selectedInfo = $null
$selectedInfo = $sessionListBox.SelectedItem.ToString()
$selectedInfoArray = $selectedInfo.Split(":")
$script:currentSession = $null
$script:currentSession = $script:session | ?{($_.sessionid -eq $selectedInfoArray[2]) -and ($_.servername -eq $selectedInfoArray[0]) -and ($_.browsername -eq $selectedInfoArray[1])}
$vertResolution = $script:currentSession.verticalresolution
$shadowStatusBar.Text = ""
if($script:currentSession -ne $null)
{
$controlstring="Server: $($script:currentsession.servername)`r`nBrowser Name: $($script:currentsession.Browsername)`r`nUsername: $($script:currentsession.accountname)`r`nVertical Resolution: $($script:currentsession.verticalresolution)`r`n"
$sessionInfo.Text = $controlstring
if(($vertResolution % 2) -ne 0)
{
$shadowStatusBar.Text = "The height is an odd number, your graphics may be distorted"
$sessionInfo.ForeColor = 'Red'
$sessionInfo.Text += "`r`n`r`nWARNING: THE VERTICAL RESOLUTION IS AN ODD NUMBER, YOU MAY EXPERIENCE VISUAL GLITCHES. PLEASE WALK THE USER THROUGH SETTING THE RESOLUTION TO AN EVEN NUMBER."
}
$buttonConnect.Enabled = $true
}
}#end sessionListBox_SelectedIndexChanged
$usernameTextBox_Enter={
#TODO: Place custom script here
$RemoteAssistance.AcceptButton = $SearchButton
}#end usernameTextBox_Enter
$sessionListBox_Enter={
#TODO: Place custom script here
$RemoteAssistance.AcceptButton = $buttonConnect
}#end sessionListBox_Enter
$buttonConnect_Click={
#TODO: Place custom script here
$buttonConnect.Enabled = $false
$ProcName = "msra.exe"
if ($script:msraSessionSupport -eq 1) {
$Arguments = ("/offerra " + $script:currentSession.ServerName + " " + $script:currentSession.AccountName + ":" + $script:currentSession.SessionID)
} else {
$Arguments = ("/offerra " + $script:currentSession.ServerName)
}
$ProcessStartInfo = New-Object System.Diagnostics.ProcessStartInfo $ProcName
$ProcessStartInfo.Arguments = $Arguments
$Process = [System.Diagnostics.Process]::Start($ProcessStartInfo)
}#end buttonConnect_Click
$usernameTextBox_TextChanged={
#TODO: Place custom script here
$buttonConnect.Enabled = $false
}
]]>
1
System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
SD_65Shadow
1
1
0
2
False
0
1.0.0.0
1.0.0.0