-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathodrzucone telefony.ps1
58 lines (40 loc) · 1.81 KB
/
odrzucone telefony.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
$string = "486 Busy here"
Write-Host -ForegroundColor Yellow "Wybiesz folder"
Add-Type -AssemblyName System.Windows.Forms
$FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
$result = $FolderBrowser.ShowDialog((New-Object System.Windows.Forms.Form -Property @{TopMost = $true }))
if ($result -eq [Windows.Forms.DialogResult]::OK) {
$Folder = $FolderBrowser.SelectedPath
}
else {
exit
}
Remove-Item -Path $Folder\* -Include *.log.7z
cd $Folder
Expand-Archive $Folder
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
$7zf = "$Folder\*"
$7zp = "" #password
# -aoa This switch overwrites all destination files. Use it when the new versions are preferred.
# -aos Skip over existing files without overwriting. Use this for files where the earliest version is most important.
# -aou Avoid name collisions. New files extracted will have a number appending to their names. You will have to deal with them later.
# -aot Rename existing files. This will not rename the new files, just the old ones already there.
$7zo = "-aoa"
sz x $7zf "-p$7zp" $7zo
Remove-Item -Path $Folder\* -Include *.7z
Remove-Item -Path $Folder\* -Include *.log
Get-ChildItem -Path $Folder -recurse | Select-String $string -Context 6 | % { $_.line + $_.Context.PostContext } | out-file "$Folder\Results.txt"
(get-content "$Folder\Results.txt") | % {
if ($_ -match "To: <sip:10(.*)") {
$name = $matches[1]
echo $name
}
} | out-file "$Folder\Result2.txt"
if (Test-Path -path "$Folder\Results.txt" -PathType Leaf) {
Remove-Item "$Folder\Results.txt"
}
get-content "$Folder\Result2.txt" |% { "10"+$_.Substring(0, 2) } | out-file "$Folder\Do exela.txt"
if (Test-Path -path "$Folder\Result2.txt" -PathType Leaf) {
Remove-Item "$Folder\Result2.txt"
}