-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComlogs-rum.ps1
54 lines (40 loc) · 979 Bytes
/
Comlogs-rum.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$TAMUSERNAME = "un"
$TAMPASSWORD = "pw"
$wshell = New-Object -ComObject wscript.shell;
$day = (get-date).day
$month = Get-Date -Format MMMM
$commlogpath = "I:\CommLogs\" + $month + "\" + $day + "_Comlog.pdf"
& 'G:\WINTAM\WAPCO.EXE' IVANS
Sleep 2
Sleep 5
$wshell.SendKeys('~')
Sleep 5
$wshell.SendKeys($TAMUSERNAME)
$wshell.SendKeys('{TAB}')
$wshell.SendKeys($TAMPASSWORD)
Sleep 2
$wshell.SendKeys('~')
Sleep 5
$target = "AppliedSystems.TAM.Business.CompanyInterface.ComLog"
$process = Get-Process | Where-Object {$_.ProcessName -eq $target}
while ($true)
{
while (!($process))
{
$process = Get-Process | Where-Object {$_.ProcessName -eq $target}
start-sleep -s 45
}
if ($process)
{
$wshell.SendKeys("{TAB}")
$wshell.SendKeys("{TAB}")
$wshell.SendKeys("{TAB}")
$wshell.SendKeys("{ }")
$process.WaitForExit()
start-sleep -s
$process = Get-Process | Where-Object {$_.ProcessName -eq $target}
Sleep 15
Stop-Process -processname utilmgr
exit
}
}