Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.167
OS: Windows 10 Pro (64 Bit)
Build: v10.0.17763.0
Hi I have a question.
If I have a gui with two textboxes and one button what is the easiest way to create a local windows user without create a password for that user.My textboxes are one for username and one for description. I have also created a regular consolescript whith two mandatory parameters. what I have tried so far are creating a empty form with the control mentioned above but nothing happening. The creating process for users involves admin rights and add the user to a groupe but my ps1 script is taking care o that.
for the moment I am not able to upload the form.
thanks in advanced
Crete user with parameter gui
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Crete user with parameter gui
Hi
My issue is the nothing happened unfortunately I removed the code but shouldn't I be able to write something like
the textbox.textproperty and pass that to the button.click event? I don't get any error back but when I check in the control panel under users nothing the. and when I run my regular script I get success
so new-local user -Name = $textbox.text -description $textboxdescription.text -nopasword | out-string or are I am missing something?
My issue is the nothing happened unfortunately I removed the code but shouldn't I be able to write something like
the textbox.textproperty and pass that to the button.click event? I don't get any error back but when I check in the control panel under users nothing the. and when I run my regular script I get success
so new-local user -Name = $textbox.text -description $textboxdescription.text -nopasword | out-string or are I am missing something?
Re: Crete user with parameter gui
Hi
i have to come back with that soon. i an not on my main computer now but i will try your suggestion and post the result as soon as possible thanks for help so far.
i have to come back with that soon. i an not on my main computer now but i will try your suggestion and post the result as soon as possible thanks for help so far.
Re: Crete user with parameter gui
Here is a quick example:
Code: Select all
Try{
New-LocalUser -Name $textboxName.Text -Description $textboxDescription.Text -NoPassword -ErrorAction Stop
}
Catch{
[System.Windows.Forms.MessageBox]::Show($_)
}
Re: Crete user with parameter gui
Hi again
An update on my issue. First the try catch block worked should though of that earlier. Second somehow I have referenced to control that doesn't exist so I referenced to another name for my button controll. I checked in the designer on my button control and the name was different. Anyway thanks for your help that put me in the right direction really helpful. the next thing is to put the user in the users group so it becomes active but that will be for another day again thanks again
An update on my issue. First the try catch block worked should though of that earlier. Second somehow I have referenced to control that doesn't exist so I referenced to another name for my button controll. I checked in the designer on my button control and the name was different. Anyway thanks for your help that put me in the right direction really helpful. the next thing is to put the user in the users group so it becomes active but that will be for another day again thanks again