@@ -85,6 +85,7 @@ $Lang = {
85
85
[string ]$l33 = " Переконайтеся, що WinRM запущено та правильно налаштовано."
86
86
[string ]$l34 = " Для моніторингу localhost виберіть "" Моніторинг поточного ПК"" в меню програми."
87
87
[string ]$l35 = " Створення CIM сесії для"
88
+ [string ]$l36 = " Увімкнути запис логу до файлу? (1 - Так | 0 - Ні)"
88
89
}
89
90
else {.$Lang }
90
91
.$About
@@ -120,6 +121,8 @@ $Startlocallog = {
120
121
catch {.$Invvalue }
121
122
$freq = [math ]::Round($freq , 0 )
122
123
if ($freq -lt 1 ){.$Invvalue }
124
+ $tofile = Read-Host " $l35 "
125
+ if (($tofile -ne 1 ) -and ($tofile -ne 0 )){.$Invvalue }
123
126
Write-Host " `n "
124
127
$computerlog = " localhost"
125
128
Write-Host " $l25 $computerlog ..."
@@ -190,7 +193,9 @@ $Prelog = {
190
193
Write-Host " `n "
191
194
$startmsg = " $l14 "
192
195
Write-Host " $startmsg "
193
- $startmsg | Out-File - filepath $logpath - Append String
196
+ if ($tofile -eq 1 ){
197
+ $startmsg | Out-File - filepath $logpath - Append String
198
+ }
194
199
$mainram = Get-CimInstance win32_operatingsystem - CimSession $session
195
200
[decimal ]$total = $mainram.TotalVisibleMemorySize / 1024 / 1024
196
201
$xtotal = $total | % {$_.ToString (" 0.000" )}
@@ -217,7 +222,9 @@ $Startlog = {
217
222
$xmaxusedp = $maxusedp | % {$_.ToString (" 000" )}
218
223
$log = " [$timestamp | $computerlog ] Current: $xcrtuseds Gb / $xtotal Gb ($xcrtusedp %) | Min: $xminuseds Gb ($xminusedp %) | Max: $xmaxuseds Gb ($xmaxusedp %)"
219
224
Write-Host " $log "
220
- $log | Out-File - filepath $logpath - Append String
225
+ if ($tofile -eq 1 ){
226
+ $log | Out-File - filepath $logpath - Append String
227
+ }
221
228
$timeloop = $freq
222
229
.$Loopmain
223
230
}
@@ -233,9 +240,13 @@ $Loopmain = {
233
240
$Stoplog = {
234
241
$stopmsg = " $l15 "
235
242
Write-Host " $stopmsg "
236
- $stopmsg | Out-File - filepath $logpath - Append String
243
+ if ($tofile -eq 1 ){
244
+ $stopmsg | Out-File - filepath $logpath - Append String
245
+ }
237
246
$lbreak = " `n "
238
- $lbreak | Out-File - filepath $logpath - Append String
247
+ if ($tofile -eq 1 ){
248
+ $lbreak | Out-File - filepath $logpath - Append String
249
+ }
239
250
Write-Host " `n "
240
251
Write-Host " $l16 $logpath "
241
252
.$Askadv
0 commit comments