Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User rights assignment: SeServiceLogonRight via powershell -command ...?

Status
Not open for further replies.

GEAK

Instructor
Feb 1, 2001
90
US
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top