I have a task that I need to perform on a regular basis, as follows:
[ol 1]
[li]Create a user (c/w password, no expiry)[/li]
[li]Grant that user the logon as service right[/li]
[/ol]
In all cases I'm doing this on clean/virgin, air-gapped MS operating systems running on virtual machines. The OSes include:
[ul]
[li]Windows 7 (32 & 64 bit)[/li]
[li]Windows 10[/li]
[li]Windows Server 2008 (R1 & R2, 32 & 64 bit)[/li]
[li]Windows Server 2012[/li]
[li]Windows Server 2016[/li]
[/ul]
and each may have one or more service packs installed.
The first of these steps I can do with one line at a command prompt (or batch file) using [tt]net user UserName P@ssw0rd /add[/tt] and I was hoping I could do something similar with the second step using either "powershell -command {...}" or "secedit -args". NOTE: I do NOT want to use ntrights.exe or any powershell script library (carbon, chocolaty). Ideally, I'd have both steps in a single, simple batch file that I just drop into the VM and run, no need for any additional executables or script libraries.
Is this even possible?
[ol 1]
[li]Create a user (c/w password, no expiry)[/li]
[li]Grant that user the logon as service right[/li]
[/ol]
In all cases I'm doing this on clean/virgin, air-gapped MS operating systems running on virtual machines. The OSes include:
[ul]
[li]Windows 7 (32 & 64 bit)[/li]
[li]Windows 10[/li]
[li]Windows Server 2008 (R1 & R2, 32 & 64 bit)[/li]
[li]Windows Server 2012[/li]
[li]Windows Server 2016[/li]
[/ul]
and each may have one or more service packs installed.
The first of these steps I can do with one line at a command prompt (or batch file) using [tt]net user UserName P@ssw0rd /add[/tt] and I was hoping I could do something similar with the second step using either "powershell -command {...}" or "secedit -args". NOTE: I do NOT want to use ntrights.exe or any powershell script library (carbon, chocolaty). Ideally, I'd have both steps in a single, simple batch file that I just drop into the VM and run, no need for any additional executables or script libraries.
Is this even possible?