I need to run the following cmd for each enabled local user on a machine:
net user exampleusername /Active:YES
I’m using the following command to pull a list of enabled users on the computer:
Get-LocalUser | where Enabled -EQ “True” | select -Property “Name”
I’m having some trouble figuring where I need to incorporate the ForEach-Object loop in this and how to use variables properly. Can anyone point me in the right direction?
submitted by /u/Cutsman3
[link] [comments]
The post Need a little help with my ForEach-Object loop. appeared first on How to Code .NET.