Обновить
4
0

Пользователь

Отправить сообщение
Конечно, не против, добавляйте.
Вдохновился статьей и по вашему образцу настроил у себя, но в вашем примере не понравилось пропадание графика при падении ниже 5%.
Поэтому добавил копию зонда без проверки уровня, а у первого выключил график.
PS 5 хоть и ругается, но работает.

Про динамик понятно (1 и 3 ошибки), просто по хорошему стоит сначала проверять его наличие. А вторая ошибка явный баг.

Нерабочий PS 6 это оказывается «фича» techcommunity.microsoft.com/t5/Windows-PowerShell/Powershell-Core-loading-assemblies/m-p/355539 stackoverflow.com/questions/57212545/how-to-add-some-types-in-powershell-6-i-can-do-in-powershell-5 возможно заработает в 7.
И еще вдогонку:
Windows server 2016 @ Powershell 5
Запускается, выдавая первую ошибку. После нажатия Reload выдает 2 и 3.

Windows PowerShell
(C) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены.

PS > $PSVersionTable

Name Value
---- -----
PSVersion 5.1.14393.3053
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3053
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

PS C:\PS ping> .\script.ps1
Исключение при вызове "Speak" с "1" аргументами: "Обнаружена ошибка звукового устройства. - Error Code: 0x2"
C:\PS ping\script.ps1:15 знак:3
+ $voice.Speak("Ошибка! Хост " + $path_ip + ", недоступен!")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : AudioException

Не удается найти свойство "imageLocation" для данного объекта. Убедитесь, что оно существует и его можно задать.
C:\PS ping\script.ps1:11 знак:3
+ $PictureBox.imageLocation = $script_path + "\yes.png"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

Исключение при вызове "Speak" с "1" аргументами: "Операция является недопустимой из-за текущего состояния объекта."
C:\PS ping\script.ps1:15 знак:3
+ $voice.Speak("Ошибка! Хост " + $path_ip + ", недоступен!")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException

Cancel


Windows server 2016 @ Powershell 6
Не запускается совсем.

PS > $PSVersionTable

Name Value
---- -----
PSVersion 6.2.1
PSEdition Core
GitCommitId 6.2.1
OS Microsoft Windows 10.0.14393
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

PS > .\script.ps1
Add-Type : Cannot find path 'C:\PS ping\System.Windows.Forms.dll' because it does not exist.
At C:\PS ping\script.ps1:2 char:1
+ Add-Type -assembly System.Windows.Forms
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\PS ping\System.Windows.Forms.dll:String) [Add-Type], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.AddTypeCommand

Exception setting "Rate": "Object reference not set to an instance of an object."
At C:\PS ping\script.ps1:7 char:1
+ $voice.Rate = 5
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting

New-Object : Cannot find type [System.Windows.Forms.Form]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:34 char:16
+ $main_form = New-Object System.Windows.Forms.Form
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:35 char:1
+ $main_form.Text = 'Links up'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'Width' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:36 char:1
+ $main_form.Width = 250
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'Height' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:37 char:1
+ $main_form.Height = 250
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'AutoSize' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:38 char:1
+ $main_form.AutoSize = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'TopMost' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:39 char:1
+ $main_form.TopMost = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

New-Object : Cannot find type [System.Windows.Forms.Label]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:59 char:35
+ ... ne -label ($label_obj = New-Object System.Windows.Forms.Label) -path_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

New-Object : Cannot find type [system.Windows.Forms.PictureBox]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:60 char:45
+ ... ($PictureBox_obj = New-Object system.Windows.Forms.PictureBox) -path_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:62 char:2
+ $main_form.Controls.Add($labels[$i])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:63 char:2
+ $main_form.Controls.Add($PictureBoxs[$i])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Cannot find type [System.Windows.Forms.Label]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:59 char:35
+ ... ne -label ($label_obj = New-Object System.Windows.Forms.Label) -path_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

New-Object : Cannot find type [system.Windows.Forms.PictureBox]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:60 char:45
+ ... ($PictureBox_obj = New-Object system.Windows.Forms.PictureBox) -path_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:62 char:2
+ $main_form.Controls.Add($labels[$i])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:63 char:2
+ $main_form.Controls.Add($PictureBoxs[$i])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Cannot find type [System.Windows.Forms.Label]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:59 char:35
+ ... ne -label ($label_obj = New-Object System.Windows.Forms.Label) -path_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

New-Object : Cannot find type [system.Windows.Forms.PictureBox]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:60 char:45
+ ... ($PictureBox_obj = New-Object system.Windows.Forms.PictureBox) -path_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:62 char:2
+ $main_form.Controls.Add($labels[$i])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:63 char:2
+ $main_form.Controls.Add($PictureBoxs[$i])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Cannot find type [System.Windows.Forms.Label]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:69 char:14
+ $Label0 = New-Object System.Windows.Forms.Label
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:70 char:1
+ $Label0.Text = Get-Date
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'Location' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:71 char:1
+ $Label0.Location = New-Object System.Drawing.Point(80,180)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'AutoSize' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:72 char:1
+ $Label0.AutoSize = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

New-Object : Cannot find type [System.Windows.Forms.Button]: verify that the assembly containing this type is loaded.
At C:\PS ping\script.ps1:74 char:14
+ $Button = New-Object System.Windows.Forms.Button
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

The property 'Location' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:75 char:1
+ $Button.Location = New-Object System.Drawing.Size(100,200)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'Size' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:76 char:1
+ $Button.Size = New-Object System.Drawing.Size(80,30)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
At C:\PS ping\script.ps1:77 char:1
+ $Button.Text = "Reload"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:79 char:1
+ $Button.Add_Click({
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:89 char:1
+ $main_form.Controls.Add($Button)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:90 char:1
+ $main_form.Controls.Add($Label0)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\PS ping\script.ps1:92 char:1
+ $main_form.ShowDialog()
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull


Заголовок спойлера
PS C:\PS ping> C:\PS ping\script.ps1
Произошла ошибка при вызове метода, так как [System.Object[]] не содержит метод с именем "Substring".
C:\PS ping\script.ps1:42 знак:27
+ $line = $data.Substring <<<< (0,47)
+ CategoryInfo : InvalidOperation: (Substring:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:51 знак:16
+ $f = $line[ <<<< $i].IndexOf("/")
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:52 знак:16
+ $l = $line[ <<<< $i].LastIndexOf("/")
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:53 знак:18
+ $ip += $line[ <<<< $i].Substring(0,$f)
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:54 знак:19
+ $capt += $line[ <<<< $i].Substring($f+1,$l-$f-1)
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Test-Connection : Не удается проверить аргумент для параметра "ComputerName". Аргумент пустой или имеет значение NULL. Укажите не пустой аргумент, не имеющий значение NULL, после чего повторите выполнение команды.
C:\PS ping\script.ps1:10 знак:41
+ if ((Test-Connection -Count 1 -computer <<<< $path_ip -quiet) -eq $True) {
+ CategoryInfo : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:51 знак:16
+ $f = $line[ <<<< $i].IndexOf("/")
+ CategoryInfo : InvalidOperation: (1:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:52 знак:16
+ $l = $line[ <<<< $i].LastIndexOf("/")
+ CategoryInfo : InvalidOperation: (1:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:53 знак:18
+ $ip += $line[ <<<< $i].Substring(0,$f)
+ CategoryInfo : InvalidOperation: (1:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:54 знак:19
+ $capt += $line[ <<<< $i].Substring($f+1,$l-$f-1)
+ CategoryInfo : InvalidOperation: (1:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Test-Connection : Не удается проверить аргумент для параметра "ComputerName". Аргумент пустой или имеет значение NULL. Укажите не пустой аргумент, не имеющий значение NULL, после чего повторите выполнение команды.
C:\PS ping\script.ps1:10 знак:41
+ if ((Test-Connection -Count 1 -computer <<<< $path_ip -quiet) -eq $True) {
+ CategoryInfo : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:51 знак:16
+ $f = $line[ <<<< $i].IndexOf("/")
+ CategoryInfo : InvalidOperation: (2:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:52 знак:16
+ $l = $line[ <<<< $i].LastIndexOf("/")
+ CategoryInfo : InvalidOperation: (2:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:53 знак:18
+ $ip += $line[ <<<< $i].Substring(0,$f)
+ CategoryInfo : InvalidOperation: (2:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Не удается индексировать в массив NULL.
C:\PS ping\script.ps1:54 знак:19
+ $capt += $line[ <<<< $i].Substring($f+1,$l-$f-1)
+ CategoryInfo : InvalidOperation: (2:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Test-Connection : Не удается проверить аргумент для параметра "ComputerName". Аргумент пустой или имеет значение NULL. Укажите не пустой аргумент, не имеющий значение NULL, после чего повторите выполнение команды.
C:\PS ping\script.ps1:10 знак:41
+ if ((Test-Connection -Count 1 -computer <<<< $path_ip -quiet) -eq $True) {
+ CategoryInfo : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand



Не работает на Windows 7 @ Powershell 2.0
Windows Server 2008 поддерживается до января 2020 года. Вероятно, она была исправлена с первой волной, и сейчас не уязвима.
В LibreOffice начиная с версии 6.2 появился NotebookBar — прямой аналог Ribbon.
Дроссель для зарядки электробайка на 50В 50А входного. Готовые почему то в продаже закончились. Электронная часть меня не волнует, ее штатно обеспечивает контролер.
Спасибо! Я год ждал эту статью. Пробовал пользоваться разными калькуляторами по расчету индуктивностей, но они вообще не давали представления откуда берут результат, а общая теория оказалась слишком заумной. В итоге все купил и бросил. Сейчас проверил свои старые выводы, все оказалось верно. Повод наконец собрать.
7-zip
ключи -sni (Store NT security information) и -sns (Store NTFS alternate Streams)
1. 60 мегабайт от 32 Гигабайт это 0,2%, а не 2%.
2. У жесткого диска, в отличие от компакт-диска, запись идет от края внутрь, соответственно и максимальная скорость падает по мере записи.
Упс, уже не может. Лавочку закрыли.
Опенсорсные драйвера бесплатно может подписать фонд ReactOS. habr.com/post/111351
Поменяйте название пока не поздно. Уже есть другая программа с таким названием. aspia.ru/aspia
Тоесть Волгу пересекать можно, а Мертвое море (которое на самом деле озеро) — нельзя, ну ок.

Информация

В рейтинге
Не участвует
Зарегистрирован
Активность