Answer the question
In order to leave comments, you need to log in
Forms.TextBox in PowerShell passes technical information, how to pass text?
Hello.
I'm trying to write a small script to send messages to users on the local network.
But for some reason, technical information is transmitted from the TextBox along with the entered text.
Any ideas how to fix it?
$ErrorActionPreference = "silentlycontinue"
# Подключаем то, с помощью чего будем рисовать нашу форму
Add-Type -assembly System.Windows.Forms
$mainWindow = New-Object System.Windows.Forms.Form
$mainWindow.Width = 400
$mainWindow.Height = 400
$proverka = New-Object System.Windows.Forms.TextBox
$proverka.Location = New-Object System.Drawing.Point(20,50)
$proverka.Size = New-Object System.Drawing.Size(150,20)
$proverka.Text = "Проверка"
$mainWindow.Controls.Add($proverka)
$button = New-Object System.Windows.Forms.Button
$button.Location = New-Object System.Drawing.Point(20,70)
$button.Size = New-Object System.Drawing.Size(150,20)
$button.Text = "Отправить"
$mainWindow.Controls.Add($button)
$button.Add_Click({
$request = $proverka.Text
c:\windows\system32\msg.exe * /Server:localhost $proverka
})
$mainWindow.ShowDialog()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question