Lightweight LAPS solution for INtune (MEM)

Managing local admin accounts using Intune has a lot of quirks, my tele-colleague Rudy Ooms has already written extensively about this. He also wrote a PowerShell solution to rotate a specific local admin’s password and had the genius idea of using Proactive Remediations (a MEM feature) to display passwords to admins, integrated / free in the Intune Console.

However, I felt I needed a more lightweight solution that;

  • does not require/modify registry keys
  • does not store the password locally
  • can encrypt the password if desired
  • does not need separate detection and remediation scripts
  • automatically provisions a local admin account
  • can remove any other local admin accounts if desired
  • can whitelist approved admins or groups from AzureAD or Active Directory
  • is language/locale-agnostic (e.g. ‘Administrators’ vs ‘Administradores’….)

Thus LeanLAPS was born!

To install/use:

1. head into the Proactive Remediations section of MDE and click Create script package:

2. Fill out some details:

3. Download and doublecheck the config of LeanLAPS.ps1 (e.g. configure if other local admins should be removed, what the local admin name should be and the password length). Make sure to use NotePad++ / that the file stays UTF-8 Encoded without a BOM.

4. Set both the detection and remediation script to LeanLAPS.ps1 and run it in 64 bit:

5. Assign to a group and deploy. By default it will run every day, but you can also let it run more or less frequently, which determines how often the password is reset (hourly in below example):

6. Deploy, and then click on the script package:

7. Go to Device status and add both output columns:

Congratulations, you can now see the current local admin passwords for all managed Windows 10 devices!

Note: if you wish to trigger a quick remediation, delete the correct keys under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies\Scripts\Execution and Reports in the client’s registry, then restart the IntuneManagementExtension service and the remediation will re-run within 5 minutes.

8. If you want to display an encrypted password in Intune, generate a public and private key and configure the resulting values in gui.ps1 and leanLAPS.ps1

9. If you don’t want LeanLAPS to remove certain preapproved admins or groups as admin, make sure to configure the $approvedAdmins variable.

RBAC

If you provide e.g. your helpdesk with the correct Intune roles, they will be able to see local admin passwords as reported by above solution:

GUI

The community, in the form of Colton Lacy, also added an optional GUI frontend for LeanLAPS which you could use for e.g. helpdesk staff:

https://gitlab.com/Lieben/assortedFunctions/-/blob/master/leanLAPS/gui.ps1
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

280 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Jonathan
Jonathan
7 months ago

Awesome work! Is there any way we can keep the 2 azure AD SIDs for global and local admins that get added when a machine is joined to azure while removing any other local admin? We want to keep the ability to use the local admin group via azure portal while removing any previous local admins. When running the script I notice my azure ad machines lose their global\local admin SIDS.

jonson
jonson
9 months ago

Nice work! I’ve upgraded your solution with encryption the password with public key, and sending it securely . it can then be decrypted with private key , so the password is never exposed in user’s computer, on the post to intune or in the intune itself. (and so there is no need to delete intune logs to cover up tracks 🙂

also found that some computers having error changing password with error 3221226252 .
i was able to resolve it by splitting the line where ConvertTo-SecureString happens, so i first create the secure-string and then change the administrator password .

dfitelw
dfitelw
3 months ago

Microsoft makes this such a pain in the neck. Then to add insult to injury your solution requires additional licensing above what we already have, just to implement a feature that should already exist.

SIGH.

Simon
Simon
8 months ago

Looks great, thank you.
We are soon to decommission AD and go Azure cloud only.
Can I confirm if this solution still requires AD in the way LAPS does?
i.e. I’m looking for a solution of local admin password management that will work without AD

Gold
Gold
1 year ago

Thanks, Jos. This is awesome! I’m getting the following error – have updated the variable $localAdminName = “CustomAccount” New-LocalUser : A positional parameter cannot be found that accepts argument ‘True’. At C:\WINDOWS\IMECache\HealthScripts\601ec906-1ca6-4958-8678-089ca2e3217e_1\detect.ps1:53 char:19 + … ocalAdmin = New-LocalUser -PasswordNeverExpires $True -AccountNeverEx … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-LocalUser], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewLocalUserCommand C:\WINDOWS\IMECache\HealthScripts\601ec906-1ca6-4958-8678-089ca2e3217e_1\detect.ps1 : Something went wrong while processing the local administrators group Cannot validate argument on parameter ‘Member’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException… Read more »

Steven Walker
Steven Walker
1 year ago

That is very clever. I like it and see a lot of usage and need for this. Great job.

Last edited 1 year ago by Steven Walker
Hubo Bomo
Hubo Bomo
7 months ago

First of all, thank you very much! We were looking for this solution 🙂 We modified it to encrypt the password, so there is no need to create the scheduled task during the Proactive Remediation. First, you generate and keep the private and public keys: ## Generate key pair $RSA = New-Object System.Security.Cryptography.RSACryptoServiceProvider(2048) $private = $rsa.ExportCspBlob(1) $private -join "," $public = $rsa.ExportCspBlob(0) $public -join "," Then, in the script you can add a function like below with your public key as a string separated by commas.     ## Encrypt Password using the Public key     Function Encrypt-Password ($password)… Read more »

Patrick
Patrick
7 months ago

Just a litle heads up

$onlyRunOnWindows10 = $True #buildin protection in case an admin accidentally assigns this script to e.g. a domain controller

[Environment]::OSVersion.Version.Major -ne 10

Windows Server 2016 and 2019 will report 10, so it will not prevent a server to run it.

Great solution BTW, thank you

Last edited 7 months ago by Patrick
Jens
Jens
9 months ago

Hello, we implemented your script in MS Endpoint manager. There is just one problem for us, when the script runs, it also puts a checkmark at “user must change password at next login”. Is there a way to avoid this by altering the script?
The Set-LocalUser has no syntax to disable this option for the local admin account.

Marko
Marko
9 months ago

Great solution, very nice! I have two questions: 

First, you wrote under 5. “Assign to a device group (user groups won’t work)” -> I tried it with a user group in my tests and it works with no issues. Could it be that your advice pointed to a earlier version of the tool?

Second, the copyright says “not for commercial use without written consent” -> what is the correct way the get this consent from you? We’d very much like to use your tool in our production environment.

Senior Feet
Senior Feet
1 year ago

As always, thanks for the amazing contribution! I was just about to set up the LAPS azure blob storage method I’ve read about elsewhere until I noticed your link on the user voice.

Just noticed one thing, we hot-desk and in my HAADJ environment if there is more than one user logged in to a workstation (switch user is enabled). The detection and remediation runs twice in succession, once against each active user. Not a big issue but just thought I’d flag it for your attention.

Adam
Adam
2 days ago

Hi,

Great solution this, the one issue I seem to have is the sync’s. So I set the remediation to every hour, however the password remains the same the next day. Does it need a reboot for this to kick in? If so, could this become unsafe if the user could potentially have the local admin password until the device is rebooted?

Thanks,

A

Lauri
Lauri
2 days ago

I’ve noticed LAPS has stopped working. Been like this for a few weeks now. It does not actually run on the device. There are no Pre or Post-remediation errors.Seems the script is running somewhat successfully but I can’t use the password.I can see it is not running every hour…even after device syncSome devices that have just been synced show the last run a few days ago. But that is not the main issue I guess, when I try to use the password it does not accept it. Any suggestions? Not sure if Windows has changed something or some other thing… Read more »

Arun
Arun
11 days ago

can you please explain how to create GUI.

Aaron Hall
Aaron Hall
20 days ago

This is a fantastic solution that I’d love to implement in my organization. However, my organization does allow a rather extensive list of users with legitimate needs to have admin rights (at least temporarily), and we’re not ready to implement a more robust solution (yet). As such, maintaining the list of SIDs is exhausting, since the list often changes. In my scenario, the users are maintained in two groups synced to AAD from AD (one for permanent admin rights and one for temporary 5 day rights). In the old days, the groups were GPO added to ALL workstations (because of… Read more »

Chris Wright
Chris Wright
24 days ago

Hello I get the following error when running the GUI as Intune Administrator or Service Desk users.

************** Exception Text **************
System.Management.Automation.CmdletInvocationException: HttpRequestError —> Microsoft.Intune.PowerShellGraphSDK.PSGraphSDKException: HttpRequestError —> System.Net.Http.HttpRequestException: 401 Unauthorized
{“error”:{“code”:”UnknownError”,”message”:”{\”ErrorCode\”:\“Forbidden\“,\”Message\”:\”{\\r\\n \\\”_version\\\”: 3,\\r\\n \\\”Message\\\”: \\\”An error has occurred – Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 – Activity ID: a4df0c5f-56e7-4362-98f5-83b96629d82a – Url: https://fef.msub05.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/deviceHealthScripts%28%2710c1b6a4-add4-4334-b8fe-7820c2362ab4%27%29/deviceRunStates?api-version=5022-04-14&$filter=managedDevice%2fdeviceName+eq+%27weazl-gyr4hr2%27&$select=postRemediationDetectionScriptOutput&$expand=managedDevice(%24select%3ddeviceName%2coperatingSystem%2cosVersion%2cemailAddress)\\\”,\\r\\n \\\”CustomApiErrorPhrase\\\”: \\\”\\\”,\\r\\n \\\”RetryAfter\\\”: null,\\r\\n \\\”ErrorSourceService\\\”: \\\”\\\”,\\r\\n \\\”HttpHeaders\\\”: \\\”{\\\\\\\”WWW-Authenticate\\\\\\\”:\\\\\\\”Bearer realm=\\\\\\\\\\\\\\\”urn:intune:service,c3998d6e-2e37-4c56-87b5-7b444ee1cb26,f0f3c450-59bf-4f0d-b1b2-0ef84ddfe3c7\\\\\\\\\\\\\\\”\\\\\\\”}\\\”\\r\\n}\”,\”Target\”:null,\”Details\”:null,\”InnerError\”:null,\”InstanceAnnotations\”:[]}”,”innerError”:{“date”:”2022-06-09T08:11:05″,”request-id”:”a4df0c5f-56e7-4362-98f5-83b96629d82a”,”client-request-id”:”a4df0c5f-56e7-4362-98f5-83b96629d82a”}}}
  

If I run with a GA account it works fine. Any ideas what permission is required?

Last edited 24 days ago by Chris Wright
Nate
Nate
26 days ago

I noticed just recently that this is reporting a new password but the devices themselves aren’t having the reported passwords applied to them.

Craig
Craig
1 month ago

If I delete a device from intune, how do I then use the LAPS tools to log into the device with the local admin account? It seems the LAPS data also deletes when the device is deleted.

Paul S
Paul S
1 month ago

it looks like the script query you need to run to get a list of your remediation scripts no longer works (at least not for me) it just returns an error. https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts

dj56
dj56
1 month ago

Generally this works very well, occasionally the device will not accept the admin password. What do you recommend we do to troubleshoot when that happens?

whoisasking
whoisasking
2 months ago

Hey Jos,
This works like a charm.
Can you please explain the purpose of line 177 and what it does?
“$res = Set-Content -Path $markerFile -Value (ConvertFrom-SecureString $newPwdSecStr) -Force -Confirm:$False”?
Why is the script writing to temp?
Thanks again for the awesome script.

David Taylor
David Taylor
2 months ago

Great concept! I tested this initially with no encryption. I also upgraded your solution by converting the .ps1 to an .exe by using a PS1 to EXE generator and included an icon for the app. I did this to prevent the script from being modified or changed by inexperienced support personnel. After my initial test, however, I tried using the encryption process but I am having issues when attempting to encrypt the password. I have configured the private and public keys in their respective areas of the scripts. The password is encrypted into MEM, but when running the gui.ps1 script… Read more »

Screen Shot 2022-04-06 at 11.39.39 AM.png
Alex
Alex
2 months ago

Great work! Thank you!

But I noticed that built-in administrator doesn’t disable if I set up $disable Builtin Admin Account = $True

Where can be a problem ?

Chad
Chad
3 months ago

Hi! I’m utilizing this within my company. I’m getting the incorrect username and password error when attempting to use the local admin account. This is some pretty great stuff and any help will be appreciated!

Maximiliano Morsia
Maximiliano Morsia
3 months ago

What kind of rights are needed to run the GUI.ps1 script? I get the request to login with my admin account, but seems like my credentials aren’t enough to run it.

Last edited 3 months ago by Maximiliano Morsia
Maximiliano Morsia
Maximiliano Morsia
3 months ago

Thanks! This is very useful! I’m trying to implement this in our environment, however I noticed the Local admin created by the script has the tendency to recheck its “User needs to change password at next logon” setting every now and then, thus making the password useless. Any advice on that?

Prajwal
Prajwal
4 months ago

This is a great solution, is there a way can we get the logs for audit purposes, who used the passwords and when on which device did they use something like this?

Jon
Jon
5 months ago

Works the 1st time it runs but after that the script Pre-remediation detection output says it failed because the specified local admin account already exists. Is anyone else having this issue? Do I need different detection and remediation scripts?

Moshe Razlan
Moshe Razlan
5 months ago

Hi I have an error with the GUI , can you help ?

LeanLapsError.jpg
MatthewC
MatthewC
5 months ago

Hello!
Ive been trying to use your script. It seems towork but when i go to Post-Remedition Detection output all I get is the attache screenshot with a string of numbers….all i changed in the script was the admin account name and $minimumPasswordLength = 10 not 21
Am i doing something wrong?

Cheers

Owen
Owen
5 months ago

Jos, this is amazing and working flawlessly for locally created user accounts, any thoughts on how to remove the AzureAD\Username accounts? getting the following errors about the account not being found.

localadminRemoval3.png
JTech
JTech
5 months ago

Hi, Love the script but, I seem to have one issue where it creates the local admin account as disable vs. enabled. Any one have any ideas as to why? or experience similar issues?
I tried adding :

Enable-LocalUser -Name “InsertAdminAccountNamehere”
at line 98 but no luck

Gary
Gary
5 months ago

Hi Jos,

Good work, I have tested and everything is working as expected.

I work for an MSP and would love to deploy this solution to our clients to replace on-premises LAPS as we complete cloud migrations. This isn’t something we are looking to sell, just a tool to use as a replacement for on-premises LAPS. I understand you need to give consent to allow us to use this tool before we do.

Thanks,
Gary.

Da_SyEnTisT
Da_SyEnTisT
6 months ago

I’ve been using this solution for a couple of weeks now. But I started seeing some endpoint gving me this Post-remediation detection output:

REDACTED

What could be causing this ?

This is the output from the gui tool

Local Username  : .\REDACTED
Password     : REDACTED
Password Changed : REDACTED

Stephen
Stephen
6 months ago

I have this set to run Daily and repeat every 30 days and have it assigned to all my devices. However, in the device status page I’m seeing it being run multiple times a day with different username’s associated with the status. This makes it very hard to determine what the current password is if I have to check 3-4 different outputs to determine the password. Any reason why I’d be seeing this?

GreeZdLightNin
GreeZdLightNin
6 months ago

I am getting this error when trying to run the GUI…any thoughts ?

lapsguifail.png
Jonathan
Jonathan
6 months ago

Hi Jos! Hope all is well! Been testing the new encryption option and running into an issue with the GUI. I loaded your old GUI I had working with the previous laps version without encryption and the old gui shows multiple logons if the machine had multiple users and also the different times the password was updated. The new GUI will only show 1 result and is the first result. Never any of the new password syncs show. I can see the passwords being updated in the intune portal. I made a fresh machine to test as well and same… Read more »

Patryk Wypych
Patryk Wypych
7 months ago

Does any one have instruction how to install this GUI?

Hello
Hello
8 months ago

Hi,
this works great. I set the script to run every 1 hour to check logs frequently…However, it happens on some machines that scheduled task just stopped working and never clears the log file. Is there any way to troubleshoot this? I can’t even see it within missed runs using:
Get-ScheduledTask | Get-ScheduledTaskInfo | ? NumberOfMissedRuns -gt 0

Scheduled task is not listed there.

Tristan
Tristan
8 months ago

Groeten!
The tool is great, thank you.
I have just one issue after implementing it:
I can’t execute elevated apps with AD admin accounts anymore.
A dialog box opens that the domain admin does not have sufficient rights to start the elevated process, ie. cmd.exe.
Elevating processes is now only possible by using the local admin account.
Is this behaviour a known issue?

VICTOR AL-HILFI
VICTOR AL-HILFI
8 months ago

Dear,

I have an issue, when I check I see that some laptops with one entry and others with two entries for the same laptop.

Do you have an idea how we can modify the script so it fixes this issue?

Note the two entries will work fine (one of them) but not the only one entry.

Thanks in advance

Maikel
Maikel
8 months ago

Hi,
great script, and it works nice, but I’ve one question.

when the script is running, I see the password in plain text in the registry.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies\Scripts\

after 5 min. the password is removed and changed to REDACTED.

Is it possible to change this faster?

djolenole
djolenole
8 months ago

Hello,

This works great.
I have only one issue, can’t remove AzureAD account account from Administrators group!?

If user account is added from AzureAD as local admin(AzureAD\Intunetest5) I am not able to remove it using this script(attached screenshot), it says: Principal Intunetest5 was not found.

However, I can do that if I run this script on the specific computer locally in Powershell ISE.

Log error:
<![LOG[error from script =Remove-LocalGroupMember : Principal Intunetest5 was not found.
At C:\Windows\IMECache\HealthScripts\2c2ccb13-58f8-41ea-bb92-e8ea3e96450b_4\detect.ps1:48 char:32
+ …   $res = Remove-LocalGroupMember -Group $administratorsGroupName – …
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo     : ObjectNotFound: (Intunetest5:String) [Remove-LocalGroupMember], PrincipalNotFoundExcepti 
  on
  + FullyQualifiedErrorId : PrincipalNotFound,Microsoft.PowerShell.Commands.RemoveLocalGroupMemberCommand

admin.JPG
Jithin
8 months ago

Is there any way to make the password change monthly instead of daily?

Mohan
Mohan
9 months ago

Thank you so much for making this Script

I would like to add some special characters in password , tried on line 26 by adding special characters
password generated ,but not working.

please suggest me.

Gerard
Gerard
9 months ago

Great solution, thanks Jos! 
I noticed that a protector has been added to make sure that the script only runs on Windows10 devices ($onlyRunOnWindows10). How can I add support for Windows11 devices?

Djordje
Djordje
9 months ago

Hello,

this is the best solution that I found! Tested it and it works great.
Is it possible for the end user to get his(local Administrator account) password somehow?

For example, we use LAPS in our internal environment and all users are able to read password ONLY for their computer that is valid for 30 days and after that the new one is generated.

Maarten
Maarten
10 months ago

Thank you Jos,
 
The scripted is great. tested it on a few machines. awesome.
 
The file %TEMP%\LeanLaps.marker will it hold the
password in plaintext? I see a remove-item further
along the script? How long will this file be present on the system? If no issues occur, will the file be deleted anyway?

Kim
Kim
10 months ago

Hi Jose,

How can I Make sure that the password always contain the password policy requirements. See below error on one of the machines:

Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain.

Kim
Kim
10 months ago

Set-LocalUser : An unspecified error occurred: status = 3221226252 At C:\WINDOWS\IMECache\HealthScripts\a8a4d830-4dc2-4d9b-8ef8-6730be343fea_1\detect.ps1:114 char:30 + … ocalAdmin | Set-LocalUser -Password ($newPwd | ConvertTo-SecureString … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (LapsAdmin:LocalUser) [Set-LocalUser], InternalException + FullyQualifiedErrorId : Internal,Microsoft.PowerShell.Commands.SetLocalUserCommand

Jhony Andrade
Jhony Andrade
10 months ago

Hi, Jos.

Thanks for this great contribution.

How can I exclude azure groups (Azure AD joined devices or global Admin) ?.

Jhony Andrade
Jhony Andrade
10 months ago

Hello Jos.

What a pleasure this publication, grateful for the contribution.

I want to ask for your help, implement your solution with the option $ removeOtherLocalAdmins = $ True this will remove the Global Administrator and Device Administrator groups from azure.

1- You know how you can exclude these groups within the code so that you do not eliminate them. ?

2- Do you know how I can recover the azure Global Administrator and Device Administrator groups on the computers that were deleted?

Thank you very much for your help, Greetings

Optimus Grind
Optimus Grind
10 months ago

Can the license requirements for the proactive remediations component be ignored for this solution?

Iggy
Iggy
10 months ago

Hi Jos, thank you for such a fantastic solution!
Regarding the aspect of the passwords stored in cleartext in the log files, I’ve seen that in the past you suggested restricting FS permissions to the “Logs” folder.
What would be other alternatives to contain this risk?
Have you considered including this aspect to the solution?
Thank you in advance!

Dylan
Dylan
11 months ago

So I’m seeing several duplicate entries in the proactive remediation list using this method. Any ideas why? They also seem to have two different passwords.comment image

Last edited 11 months ago by Dylan
ashoka
ashoka
11 months ago

excellent contribution thank you very much
I have a question I have incorporated this solution but I do not know why it seems that runs with the user account and system account for each machine I have 2 runs with different passwords and in some log of the machines I’m getting the message WRITING what does this mean?

Vanier Francis
Vanier Francis
11 months ago

Hi, could you tell me if the password is transmitted cleartext or encrypted between the local pc and Intune?

chris
chris
11 months ago

Is there a way to test this locally first. Whenever I run it nothing happens. I’m running as Admin and with ExecutionPolicy set to Bypass.

All I get is the script running and finishing in 2 seconds the Event logs shows only shows that script started no other info or errors. Nothing changes in the local admins group.

Jason
Jason
1 year ago

Is there a reason you left 1 and special characters out of your password generation section of your script?

Lee
Lee
1 year ago

This solution is so elegant! I’ve only tested it on couple of machines but it looks promising. Thank you!

TheSCCMBoy
1 year ago

the solution is generally great but not secure. If you even use the task scheduler the attacker has the possibility to read the intunemanagementextension.log. I will think about to optimize the solution how we can query them correctly and transfer secure directly to the proactive remediation feature as post-remediation output.

kind regards
TheSCCMBoy

Peter JM
1 year ago

Hi Jos. Thanks for the post which is very useful indeed. On line 84 and 85 you use the PowerShell [ADSI] adapter to get the members of the local administrators group. When I tested the script with my regular domain account, these commands took 30-40 seconds or more to complete. Afterwards I got a friendly warning from the SOC that I had just queried the company AD for all accounts. So I would suggest using “Get-LocalGroup -SID S-1-5-32-544” and “Get-LocalGroupMember -SID S-1-5-32-544” instead. This might also solve some of the issues described in earlier comments. And yeah…we use co-management.

Vanier
Vanier
1 year ago

Solution works great. Is there a way to force an immediate password change outside of the scheduled time?

Ákos
Ákos
1 year ago

RBCA pic is just crashed/missing; how could I define a custom role for only seeing this attribute? Not having GA and even not Intune Admin role.

chris
chris
1 year ago

Great post. Is there a way to specify a local admin account to remove. I only want to remove the “administrators” account an leave all others alone.

Also it only seems to run on 1 device in the group I selected. The 1 device is the first device I setup and added the group any additional devices it doesn’t run on. Event log has no logs, other device has been rebooted and Intune sync’d multiple times.

Last edited 1 year ago by chris
Shane Lackey
Shane Lackey
1 year ago

Hello Jos,

I keep getting this in the event log.
Something went wrong while processing the local administrators group An error occurred while enumerating through a collection: Call cancelled.

Any ideas?

Zach
Zach
1 year ago

This is great! Thank you for your hard work! This is just what I need!

I’m getting an error however:

Something went wrong while processing the local administrators group Cannot bind parameter 'Member'. Cannot convert the "\\COMPUTERNAME\root\cimv2:Win32_UserAccount.Domain="COMPUTERNAME",Name="Administrator"" value of type "System.Management.ManagementObject#root\cimv2\Win32_UserAccount" to type "Microsoft.PowerShell.Commands.LocalPrincipal".
Last edited 1 year ago by Zach
rohgin
rohgin
1 year ago

Hi Jos,

I can’t find the setting to change the maximum days between a password reset.

Is it just me or?

With regards,

rohgin

Håvard Pettersen
Håvard Pettersen
1 year ago

Hi and thank you for this elegant solution.
I downloaded the script today and test but get the same error as mention before;
Something went wrong while processing the local administrators group Cannot validate argument on parameter ‘Member’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Anders
Anders
1 year ago

Awsome feature! But all I get is “Something went wrong while processing the local administrators group An error occurred while enumerating through a collection: Call cancelled .”
No further info…

Daniël Vleeshakker
Daniël Vleeshakker
1 year ago

Hi Jos,

Great, thanks for this!

I’ve tried to use the script, but it fails at my machines on creating the user when it does not exist.

The error is: Cannot validate argument on parameter ‘Member’. The argument is null or empty. Provide an argument that is not null or empty and try again.

When running the scripts manually and asking the value of $localadmin it’s empty.