Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

display results of the power shell commands

$
0
0

Dear all, first i am new to power shell so forgive any misunderstanding

i have created the folowing power shell code that creates a  window with  buttons. Each of this buttons run power shell commands that manage microsoft lync server. What i want is to be able to see the ruselt of these lync power shell commnds in a popup window. Could you please help me on this? I mean when i press a buton a popup window with the results.

# Load the Winforms assembly
[reflection.assembly]::LoadWithPartialName( "System.Windows.Forms")

# Create the form
$form = New-Object Windows.Forms.Form
$form.Size = New-Object Drawing.Size @(300,200)
#Set the dialog title
$form.text = "Central Line"
#Set the Message title
# Create Button Remove user1
$button1 = New-Object Windows.Forms.Button
$button1.text = "Remove user1"
$button1.Location = New-Object Drawing.Point 20,9
$button1.Size = New-Object Drawing.Size @(100,30)
$button1.add_click({import-module Lync

$y = Get-CsRgsAgentGroup -Identity service:ApplicationServer:lync02.testdomain.com -Name "Central"

$y.AgentsByUri.Remove("sip:user1@testdomain.com")

Set-CsRgsAgentGroup -Instance $y

})

$form.controls.add($button1)

# Create Button Add user1
$button3 = New-Object Windows.Forms.Button
$button3.text = "Add user1"
$button3.Location = New-Object Drawing.Point 175,129
$button3.Size = New-Object Drawing.Size @(100,30)
$button3.add_click({import-module Lync

$y = Get-CsRgsAgentGroup -Identity service:ApplicationServer:lync02.testdomain.com -Name "Central "
 
$y.AgentsByUri.Add("sip:user1@testdomain.com")

Set-CsRgsAgentGroup -Instance $y
})
$form.controls.add($button3)
$form.ShowDialog()



Viewing all articles
Browse latest Browse all 15028

Trending Articles