Giter VIP home page Giter VIP logo

enforcelocaladmins's Introduction

tl;dr or the short explanation

Only once export local administrators group members to a file on a central share

Export-LocalAdminsList -FilePath C:\Temp\ComputerName.txt

Then compare the file with the group

Compare-LocalAdminsList -FilePath \\FileServer\AdminLists$\ComputerName.txt

Or enforce the file to the group

Import-LocalAdminsList -FilePath \\FileServer\AdminLists$\ComputerName.txt

The full explanation

Environments targeted by this module

  • Many servers have different local Administrators members
  • Applicative teams have been granted administrators rights on some servers and you want avoid them to add more accounts to the Administrators group

Preparation steps

  1. Copy the module to every local server (usually to C:\Program Files\Windows Powershell\Modules)
  2. Export members of the local Administrators group to a file
Export-LocalAdminsList -FilePath C:\Temp\ComputerName.txt
  1. Copy this file to a central repository.
Copy-Item -Path C:\Temp\ComputerName.txt -Destination \\FileServer\Z$\AdminLists

Monitor drifts

Schedule a Powershell script

Compare-LocalAdminsList -FilePath \\FileServer\AdminLists$\ComputerName.txt

Enforce local administrators

Schedule a Powershell script

Import-LocalAdminsList -FilePath \\FileServer\AdminLists$\ComputerName.txt

Additional information

Requirements

This module is based on Powershell 5.1 cmdlets.

Scheduled script

  • The most secure way to schedule your script is through a GPO or via DSC
  • Depending on your needs, the script you schedule, to monitor drifts or enforce local administrators, can send a mail and/or write an event in the eventlog (which can be monitored by SCOM or another tool).

Common parameters

Common parameters like -WhatIf, -Verbose and -Confirm are fully supported.

Warning about the central repository

Permissions on the central repository should be narrowed down so that authorized people and computers have only permissions they need.

Typical permissions could be:

  • Domain admins have Full Control permissions
  • Computers accounts from computers using this module have Read Only permissions
  • Computers accounts from computers not using this module have no access
  • If applicable, you can add the Read-Write permissions on files for people who manage matching computers

enforcelocaladmins's People

Contributors

fullenw1 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

guoyu07

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.