-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComlogs.ps1
58 lines (44 loc) · 1.12 KB
/
Comlogs.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
55
56
57
58
$TAMPASSWORD = "f4c91n45"
$tamdrive = "G"
$commlogpath = "I:\CommLogs\" + $month + "\" + $day + "_Comlog.pdf"
$wshell = New-Object -ComObject wscript.shell;
$day = (get-date).day
$month = Get-Date -Format MMMM
& ${tamdrive}:\WINTAM\utilmgr.exe
Sleep 5
$wshell.SendKeys($TAMPASSWORD)
Sleep 2
$wshell.SendKeys('{TAB}')
$wshell.SendKeys('{TAB}')
$wshell.SendKeys('~')
Sleep 5
$utilver = (Get-Item ${tamdrive}:\WINTAM\utilmgr.exe).VersionInfo.FileVersion
If ($utilver = "19.0"){
& C:\WINTAM\AppliedSystems.TAM.CompanyInterface.Stub.exe Batch_Transmit
}
else {
& '${tamdrive}:\Wintam\WAPCO.exe' IVANS
}
Sleep 2
$wshell.SendKeys('~')
Sleep 2
$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("{ }")
$process.WaitForExit()
start-sleep -s
$process = Get-Process | Where-Object {$_.ProcessName -eq $target}
Sleep 15
Stop-Process -processname utilmgr
exit
}
}