Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5aa70c1

Browse files
committed
New finctions
1 parent5b0d871 commit5aa70c1

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

‎source/Connect-MTGExchange.ps1‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
functionConnect-MTGExchange {
2+
if ($SessionEx) {
3+
Remove-PSSession-Session$SessionEx
4+
}
5+
$Uri="http://"+$Config.PSConnect+"/PowerShell/"
6+
$SessionEx=New-PSSession-ConfigurationName Microsoft.Exchange-ConnectionUri$Uri-Authentication Kerberos-ErrorAction SilentlyContinue
7+
if ($SessionEx) {
8+
Import-PSSession$SessionEx-DisableNameChecking-AllowClobber
9+
}
10+
}

‎source/Get-MTGTrackingLog.ps1‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
functionGet-MTGTrackingLog {
2+
if ($CBServers.IsChecked) {
3+
$Fields=""
4+
$Config.Fields.F|ForEach-Object {
5+
$Fields+=$_+','
6+
}
7+
$Fields=$Fields.TrimEnd(',')
8+
9+
$Path="$($env:LOCALAPPDATA)\ExchangeTrackingGUI"
10+
if (!(Test-Path$Path) ) {
11+
$null=New-Item$Path-ItemType Directory
12+
}
13+
$File="$Path\GetLog.ps1"
14+
15+
$Servers.SelectedItems|ForEach-Object {
16+
$Command=$PSCommand.Text+' -Server "'+$_.ToString()+'" | Select-Object'+$Fields
17+
Set-Content-Path$File-Value$Command-Force
18+
&$File
19+
}
20+
}
21+
}

‎source/Get-MessageTrackingGUI.ps1‎

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@
33
functionGet-MessageTrackingGUI {
44
$Icon=Initialize-MTGIcon
55

6-
# Connect to Exchange 2016
7-
functionConnect-Exchange {
8-
if ($SessionEx) {
9-
Remove-PSSession-Session$SessionEx
10-
}
11-
12-
$Uri="http://"+$Config.PSConnect+"/PowerShell/"
13-
$SessionEx=New-PSSession-ConfigurationName Microsoft.Exchange-ConnectionUri$Uri-Authentication Kerberos-ErrorAction SilentlyContinue
14-
if ($SessionEx) {
15-
Import-PSSession$SessionEx-DisableNameChecking-AllowClobber
16-
}
17-
}
18-
196
# Visual change PSCommandText field
207
functionSet-PSCommandText
218
{
@@ -43,20 +30,6 @@ function Get-MessageTrackingGUI {
4330
$PSCommand.Text=$PSCommand.Text.TrimEnd('')
4431
}
4532

46-
functionGet-TrackingLog {
47-
if ($CBServers.IsChecked) {
48-
$Fields=""
49-
$Config.Fields.F|ForEach-Object {
50-
$Fields+=$_+','
51-
}
52-
$Fields=$Fields.TrimEnd(',')
53-
$Servers.SelectedItems|ForEach-Object {
54-
$Command=$PSCommand.Text+' -Server "'+$_.ToString()+'" | Select-Object'+$Fields
55-
Invoke-Expression-Command$Command
56-
}
57-
}
58-
}
59-
6033
functionSet-ConfigForm {
6134
$PSConnect.Text=$Config.PSConnect
6235

@@ -222,7 +195,7 @@ function Get-MessageTrackingGUI {
222195
if ($PSConnect.Text) {
223196
if ($Config.PSConnect-ne$PSConnect.Text) {
224197
$Config.PSConnect=$PSConnect.Text
225-
Connect-Exchange
198+
Connect-MTGExchange
226199
}
227200
}
228201
else {
@@ -410,15 +383,15 @@ function Get-MessageTrackingGUI {
410383

411384
# Buttons
412385
$BTSearch.Add_Click({
413-
Get-TrackingLog|Out-GridView
386+
Get-MTGTrackingLog|Out-GridView
414387
})
415388
$BTExport.Add_Click({
416389
$Path="$($env:LOCALAPPDATA)\ExchangeTrackingGUI"
417390
if (!(Test-Path$Path) ) {
418391
$null=New-Item$Path-ItemType Directory
419392
}
420393
$File="$Path\Export.csv"
421-
Get-TrackingLog|ConvertTo-Csv-NoTypeInformation>$File
394+
Get-MTGTrackingLog|ConvertTo-Csv-NoTypeInformation>$File
422395
Invoke-Item$File
423396
})
424397
$BTConfig.Add_Click({
@@ -437,7 +410,7 @@ function Get-MessageTrackingGUI {
437410
Set-ConfigForm
438411

439412
# Connect to Exchange 2016
440-
Connect-Exchange
413+
Connect-MTGExchange
441414

442415
# Show Main form
443416
$XMLForm.ShowDialog()|Out-Null

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp