Managing Windows Local Users with Net User
-
The alias was a moot point. The real commands are simple enough. There's nothing at all wrong with a New-localuser username command in any sense. Yes the Bash command of useradd is shorter, but there's no naming scheme for similar functions. Like what if you want to add an AD user? In Linux, completely different. In PowerShell, it's the same with only a minor but obvious difference. Instead of localuser, it's ADUser.
I'm sure you'll disagree in some tangential way, but IMHO it's great, simple, easy, efficient.
Then to pull and manipulate data is simple as well, by design. Each piece of data is something you can access directly using English... Name & value basically... without having to be an AWK wizard. Damn, that's a whole different discussion. I made the mistake of soda and chocolate before bed fml. I'm gonna try to force myself to sleep and see if I can find time tomorrow to catch up on story time.
-
@Obsolesce Plus, aren't we using tab to complete a lot of the time?
-
@wrx7m said in Managing Windows Local Users with Net User:
@Obsolesce Plus, aren't we using tab to complete a lot of the time?
That makes the abbreviations almost pointless.
-
@scottalanmiller True
-
@Obsolesce said in Managing Windows Local Users with Net User:
Like what if you want to add an AD user? In Linux, completely different. In PowerShell, it's the same with only a minor but obvious difference. Instead of localuser, it's ADUser.
This is where PowerShell shines a bit. Although it's a bit unfair in this particular case because we are talking about an ecosystem of PS being used for two PS specific tasks. Linux has no AD equivalent "one system to rule them all" and so doesn't have a benefit of being able to make one tool to do that for it.
Also, if you use PS on Linux, none of this works. PS uses the same useradd on Linux as Bash does. So it is really the Windows ecosystem being compared in that case, not an intrinsic functionality of PS. If you use PS on Linux, it doesn't manage additional features either.
-
I'd rather make a Powershell script than a batch file, but I'm still going to use executables to do tasks in my scripts when they are simplier, more specifically designed for the job, and there's not more advanced scripting required where I would benefit from using objects.
i.e. Copy-Item script vs using robocopy
Today I used icacls in a simple powershell script. And I always use the IIS management tool instead of the IIS powershell drive provider.
I think powershell's greatest strength is it's flexibility. Combine PS cmdlets, .Net, calling executables, even C# coded objects together to do what you need to do.
-
@scottalanmiller said in Managing Windows Local Users with Net User:
...Because of its simplicity, the net user command family is popular over remote shells such as those executed in a remote control application or through tools like psExec.
Net User Reference on Lifewire
Part of a series on Windows Systems Administration by Scott Alan Miller
Oh, man...... How true! I don't think I could get through my days anymore without net user and net accounts from a remote shell. They are the first things I do when someone says anything at all about "login issues".
-
@JasGot said in Managing Windows Local Users with Net User:
Oh, man...... How true! I don't think I could get through my days anymore without net user and net accounts from a remote shell. They are the first things I do when someone says anything at all about "login issues".
Yeah, I use these constantly. We use them through remote command execution so the PowerShell stuff doesn't work, so net commands are our friends.
-
@scottalanmiller said in Managing Windows Local Users with Net User:
@JasGot said in Managing Windows Local Users with Net User:
Oh, man...... How true! I don't think I could get through my days anymore without net user and net accounts from a remote shell. They are the first things I do when someone says anything at all about "login issues".
Yeah, I use these constantly. We use them through remote command execution so the PowerShell stuff doesn't work, so net commands are our friends.
You certainly can, if you setup the command line right and don't rely on independent connections.
We run multiline powershell commands through ScreenConnect sessions all the time to add and remove printers. You just have to paste it all into the windows at once, then hit send.
-
@JaredBusch said in Managing Windows Local Users with Net User:
You certainly can, if you setup the command line right and don't rely on independent connections.
We run multiline powershell commands through ScreenConnect sessions all the time to add and remove printers. You just have to paste it all into the windows at once, then hit send.
That's what we do too. If you can do it one line at a time, you can do it through ScreenConnect command. Just need to bump the #maxlength=100000 and
#timeout=90000 as appropriate! (values will differ)I have to say though, I'm using backstage more and more for the things I used to do in a command.
-
@JasGot said in Managing Windows Local Users with Net User:
@JaredBusch said in Managing Windows Local Users with Net User:
You certainly can, if you setup the command line right and don't rely on independent connections.
We run multiline powershell commands through ScreenConnect sessions all the time to add and remove printers. You just have to paste it all into the windows at once, then hit send.
That's what we do too. If you can do it one line at a time, you can do it through ScreenConnect command. Just need to bump the #maxlength=100000 and
#timeout=90000 as appropriate! (values will differ)I have to say though, I'm using backstage more and more for the things I used to do in a command.
I have not looked at that. I know that they added it. But I haven't tried it yet.
-
@JasGot said in Managing Windows Local Users with Net User:
I have to say though, I'm using backstage more and more for the things I used to do in a command.
MeshCentral does well, too.
-
@JasGot said in Managing Windows Local Users with Net User:
I'm using backstage more
I assume that this is a component of another product?
-
@JaredBusch said in Managing Windows Local Users with Net User:
I have not looked at that. I know that they added it. But I haven't tried it yet.
It was love at first use!
-
@scottalanmiller said in Managing Windows Local Users with Net User:
@JasGot said in Managing Windows Local Users with Net User:
I'm using backstage more
I assume that this is a component of another product?
Part of ConnectWiseControl. (or ScreenConnect as we still call it around here.)
It's at the bottom of the View tab when attached to a guest. Takes you to a new sessions as a System account with a command prompt and powershell window already open. No limit to what you can accomplish there. many gui apps will run in backstage too.