All Projects → gerryw1389 → powershell

gerryw1389 / powershell

Licence: MIT license
Powershell repo

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to powershell

Windows-On-Reins
Wor is a Powershell script to harden, debloat, optimize, enhance privacy, avoid fingerprinting and improve performance on Windows 10 and 11.
Stars: ✭ 170 (+1114.29%)
Mutual labels:  sysadmin-tool, sysadmin-scripts
sysadmin-tools
Linux Sys Admin and DevOpsy tools
Stars: ✭ 31 (+121.43%)
Mutual labels:  sysadmin-scripts
WindowsFirewallRuleset
Windows firewall PowerShell scripts
Stars: ✭ 94 (+571.43%)
Mutual labels:  powershell-adminscripts
PowerShell-WindowsAdmin
A collection of scripts I've created over the years to administer things.
Stars: ✭ 35 (+150%)
Mutual labels:  powershell-adminscripts
chronic
A tool that hides output unless the command fails; now in Go!
Stars: ✭ 19 (+35.71%)
Mutual labels:  sysadmin-tool
devops-ninja
This is a collection of some very useful command-line commands that eases the life of a DevOps Engineer.
Stars: ✭ 27 (+92.86%)
Mutual labels:  sysadmin-scripts
rbackup
Shell script for encrypted backups with rsync and GnuPG
Stars: ✭ 22 (+57.14%)
Mutual labels:  sysadmin-scripts

Powershell

This repo contains multiple modules for Powershell scripts I have written over time. Many of these may be out of date and need to be read over and improved so please do not use in production. Also, many of the functions have articles that go with them from my blog at https://automationadmin.com.

To install some of the modules:

  1. Choose "Download Zip" at the top of this page.

  2. Extract the zip.

  3. Copy the module to your user Powershell Modules folder at C:\Users\yourUserName\Documents\WindowsPowerShell\Modules

  4. Open powershell and type import-module modulename. If you copied more than one, do this for each one.

  5. At this point you may want to run Get-Command -Mod gw* to see what all imported.

  6. If you want these to be imported automatically, type notepad $profile and then paste in the same commands (import-module modulename one for each module). Save and close.

To install all the modules:

  1. Choose "Download Zip" at the top of this page.

  2. Extract the zip.

  3. Double click the "install-modules.bat" file inside the "Other" folder.

    • This script will:
    • Copy the folders from the zip to your Modules path
    • Copy the import-module command to your clipboard that loads the modules.
    • Pull up your Powershell profile and assume that you will paste in my clipboard command (save and close notepad).
    • Launch Powershell.
  4. At this point you may want to run Get-Command -Mod gw* to see what all imported.

    • You may be wondering, "What is with all these 'gw' prefixes?" Well the reason I do this is because 'ActiveDirectory' is a pretty generic name for a module. Also, Mr. Powershell, Don Jones, and many others taught me early on to put prefixes in names and it just kinda stuck with me.

Why the long Begin{} Block? / Why is 80% of your functions for logging?

  1. You will notice that I went through the trouble of putting each of these functions into a module only to have duplicate code in each script. I know this and at one point had the logging functions in the private folder called helpers.psm1 located here. I would then import that function to my public functions and have a much cleaner begin block as seen here

  2. The problem was that other admins I worked with preferred single .ps1 scripts since it's much easier to copy a single file than a zip/extract/import-module setup. I plan to bring this back in the future with some kind of Nuget repo with a CI/CD pipeline release per this reddit post but I have lots to learn first!

  3. In addition, I have been through many changes in logging itself like trying to make it optional or writing to the Windows Event Log. Eventually I just stuck with the create PSLogs folder in same directory with yyyy-MM-dd-function-name.log paradigm, see my post on it

DISCLAIMER

Please do not use these scripts in a production environment without reading them over first. Please see the MIT license for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].