Giter Site home page Giter Site logo

htcfreek / preos-resetlapspassword Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 159 KB

A PreOS-Package for Matrix42 Empirum that can reset thet LAPS password of a computer on reinstall.

License: MIT License

PowerShell 100.00%
laps matrix42 reinstall windows winpe empirum

preos-resetlapspassword's Introduction

ResetLapsPassword

A PreOS-Package for Matrix42 Empirum to reset the LAPS password of a computer on reinstall.

The package works with Windows 10 (Build 19041 and higher) or Windows 11. Legacy Microsoft LAPS and Windows LAPS are supported. An up to date Empirum WinPE environment (at least 1.8.12) and PowerShell 5.1 are required!

For more details about the LAPS modes, supported Operating Systems and configuration see the LAPS configuration table below.

The package has the Legacy LAPS PowerShell module from the Microsoft LAPS installer included. (Link to the installer: https://www.microsoft.com/en-us/download/details.aspx?id=46899)

Features

  • Supports Windows LAPS with Azure AD and local AD.
  • Supports legacy Microsoft LAPS with local AD and the legacy emulation mode of Windows LAPS.
  • Supports coexistence of legacy Microsoft LAPS and Windows LAPS as long as they manage different accounts. (More information.)
  • Support for setting the expiration time¹ and for resetting the password immediately.
  • Automatic detection of the client's LAPS configuration based on GPOs, CSP policies and Registry values.
  • Using the computer account credentials for password reset.
  • Skipping package execution if the computer is not joined to Azure AD or a local domain.
  • Skipping the password reset for Windows LAPS with Azure AD as target if already done by the system. ²
  • LAPS can be defined as mandatory using a package variable. (See package variables for more details.)

¹) Not supported in Windows LAPS with Azure AD as backup target, because of how LAPS works in this case. (More information.)
²) Because the expiration time is stored locally on the machine it gets lost on reinstall and the reset should happens automatically. (There is a package variable to force the reset.)

Download and Usage

  1. Download the archive from here.
  2. Please extract the downloaded archive to %EmpirumServer%\Configurator$\PackageStore\PreOSPackages and import the package into your Software Depot (Matrix42 Management Console > Configuration > Depot).
  3. Move the package within the depot register "Matrix42 PreOS Packages" after the "DomainJoin" package and activate it for deployment ("Ready to install").
  4. Then you can assign the package and set the package variables if you want to change the default behavior.

Package variables

  • IntuneSyncTimeout : 10 (default) or custom value.
    Number of minutes to wait for the first Intune policy sync cycle.
  • LapsIsMandatory : 0 (default) or 1
    If set to 1 the package will fail if LAPS is not enabled/configured.
  • ResetImmediately : 0 (default) or 1
    If set to 1 the password is reset immediately instead of changing the expiration time.
    (Enforced automatically in Azure AD environments, because changing the expiration time is not supported in this scenario.)
  • ForceResetForAzureTarget : 0 (default) or 1
    If set to 1, for Windows LAPS with Azure AD as target the password is reset even if already done by the system. (Because the expiration time is stored local on the machine it gets lost on reinstall and the reset should happen automatically.)

LAPS configuration requirements

Mode Supported OS Install requirements Configuration requirements ⚠ Important ⚠
Legacy Microsoft LAPS Up to the newest Windows version. MS LAPS (AdmPwd) CSE MS LAPS (AdmPwd) policies
Windows LAPS At least Windows 10¹ or Windows 11 21H2¹. built-in feature Windows LAPS GPO/CSP/Registry values
Windows LAPS in legacy MS LAPS emulation mode At least Windows 10¹ or Windows 11 21H2¹. built-in feature MS LAPS (AdmPwd) policies - MS LAPS (AdmPwd) CSE must not be installed.
- Windows LAPS configuration must not be set.
Legacy Microsoft LAPS & Windows LAPS running parallel At least Windows 10¹ or Windows 11 21H2¹. - MS LAPS (AdmPwd) CSE
- Windows LAPS as built-in feature.
- MS LAPS (AdmPwd) policies
- Windows LAPS GPO/CSP/Registry values
Both LAPS version have to manage different user accounts.

¹ For Windows 10, Windows 11 21H1 and Windows 11 22H2 the Update from April 11 2023 is required.

Support

⚠ The provided code/content in this repository isn't developed by "Matrix42 AG". It was created by the repository owner. This means that the company "Matrix42 AG" isn't responsible to answer any support requests regarding the tools, scripts and packages in this repository in any way!

If you have any problems or want to suggest a new feature please fill a bug in this repository.

Credits

This repository includes scripts (and other files) that where created while my day to day job work. I want to say thank you to my employer who allows me to share them with you (the community).

A big thank you to Mr. Jochen Schmitt, who mentioned this package in his blog and helped me with testing the initial release.

Disclaimer

Product names and company names are trademarks (™) or registered (®) trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

License

This Repository is licensed to you under the MIT license.
See the LICENSE file in the project root for more information.

preos-resetlapspassword's People

Contributors

htcfreek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

preos-resetlapspassword's Issues

Debug log shows empty managed user

If the default user is managed the logs shows no user name. That can be confusing and could be improved: Instead the logs can show an alias like <Built-in Administrator>.

Support for Automatic Account Management

Windows Laps has a new feature to manage and optional randomize the LAPS user. (If enabled these policies override the custom user policy.)

https://learn.microsoft.com/de-de/windows-server/identity/laps/laps-management-policy-settings#automaticaccountmanagementenabled

https://learn.microsoft.com/de-de/windows-server/identity/laps/laps-concepts-account-management-modes

Features:

  • Log if enabled
  • Log name properties and if custom or built-in
  • Log warning if account creation is configured to disable accounts
  • Skip account existing check if enabled

Readme: Add LAPS table

Add table to show the policy configuration required for different LAPS version.

Mode Supported OS Install requirements Configuration requirements ⚠ Notes ⚠
Legacy Microsoft LAPS Up to the newest Windows version. MS LAPS (AdmPwd) CSE MS LAPS (AdmPwd) policies
Windows LAPS Windows 11 IP built-in feature Windows LAPS GPO/CSP/Registry values
Windows LAPS in legacy MS LAPS emulation mode Windows 11 IP built-in feature MS LAPS (AdmPwd) policies - MS LAPS (AdmPwd) CSE must not be installed.
- Windows LAPS configuration must not set.
Legacy Microsoft LAPS & Windows LAPS running parallel Windows 11 IP - MS LAPS (AdmPwd) CSE
- Windows LAPS as built-in feature.
- MS LAPS (AdmPwd) policies
- Windows LAPS GPO/CSP/Registry values
Both LAPS version have to manage different user accounts.

ReadMe: Spelling mistake(s) and other things

  • Widows LAPS => Windows LAPS
  • Legacy Microsoft LAPS (only Windows 10) and Widows LAPS => Legacy Microsoft LAPS and Windows LAPS (at lest Windows 11 IP)
  • The package works with Windows 10 (Build 19041 and higher) and Windows 11. => The package works with Windows 10 (Build 19041 and higher) or Windows 11.

Log "Force Disabled"

Log "Force Disabled" (and corresponding Config Source) for both LAPS in management summary.

Windows LAPS incorrectly reported as missing

On systems that not support Windows LAPS with missing Legacy CSE the script incorrectly reports Windows LAPS as missng.

Reason: The script ignores the missing LAPS when reading the LAPS legacy configuration for Windws LAPS compatibility mode.

Rename *Azure AD*

Microsoft has changed the name of Azure AD to EntraID.

I should update the ReadMes and log text to EntraID (Azure AD).

Improve handling for WinLaps with Azure target

If Azur is the target for WinLaps then the exp.time is stored locally. Therefore the password rest happens automatically because of the missing timestamp after reinstall.

In this cases we can check Registry for an existing timestamp, skip renewal and output next expiration time.

I can add a new pkg variable to force renewal. => No regular use case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.