blob: 323fdef9db43949980a2674d220251592804492c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System.Management.Automation;
using System.Security;
namespace HyperBooru.PowerShell;
[Alias("nhbu")]
[Cmdlet(VerbsCommon.New, "HyperBooruUser")]
public class NewUserCmdlet : SessionCmdlet {
[Parameter(Position = 1, Mandatory = true)]
public string Username { get; set; }
[Parameter(Position = 2, Mandatory = true)]
public SecureString Password { get; set; }
protected override void ProcessRecord() {
var user = Session.User.CreateUserAsync(Username, Password.ToInsecureString())
.GetAwaiter()
.GetResult();
WriteObject(user);
}
}
|