From 5c7cfda48e2ecd714a95d96541ff523399f5c52b Mon Sep 17 00:00:00 2001 From: capntack Date: Sun, 2 Apr 2023 12:54:25 -0500 Subject: [PATCH] Initial Commit --- LICENSE.txt | 24 ++++++++++++++++++++++ README.MD | 0 adaccount-expiry/ADAccount-Expiry.ps1 | 10 +++++++++ adaccount-expiry/README.md | 29 +++++++++++++++++++++++++++ adaccount-expiry/ROADMAP.md | 4 ++++ check-free-space/Check-Free-Space.ps1 | 20 ++++++++++++++++++ check-free-space/README.md | 29 +++++++++++++++++++++++++++ check-free-space/ROADMAP.md | 3 +++ 8 files changed, 119 insertions(+) create mode 100755 LICENSE.txt create mode 100644 README.MD create mode 100755 adaccount-expiry/ADAccount-Expiry.ps1 create mode 100755 adaccount-expiry/README.md create mode 100755 adaccount-expiry/ROADMAP.md create mode 100755 check-free-space/Check-Free-Space.ps1 create mode 100755 check-free-space/README.md create mode 100755 check-free-space/ROADMAP.md diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100755 index 0000000..f50ef62 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..e69de29 diff --git a/adaccount-expiry/ADAccount-Expiry.ps1 b/adaccount-expiry/ADAccount-Expiry.ps1 new file mode 100755 index 0000000..03433f2 --- /dev/null +++ b/adaccount-expiry/ADAccount-Expiry.ps1 @@ -0,0 +1,10 @@ +# AD Account Expiration Script +# +# Please see the README. +# -Tack + +$expired = Search-ADAccount -AccountExpired | Select Name, SamAccountName, Manager, Enabled, AccountExpirationDate +$expiring = Search-ADAccount -AccountExpiring -TimeSpan "14" | Select Name, SamAccountName, Manager, Enabled, AccountExpirationDate +$disabled = Search-ADAccount -AccountDisabled | Select Name, SamAccountName, Manager, Enabled, AccountExpirationDate + +&{$expired; $expiring; $disabled} | Export-Csv .\ad_account_expiration_report.csv -NoTypeInformation diff --git a/adaccount-expiry/README.md b/adaccount-expiry/README.md new file mode 100755 index 0000000..e2336e5 --- /dev/null +++ b/adaccount-expiry/README.md @@ -0,0 +1,29 @@ +# ADAccount Expiry PS Script v22.01.1 + +ADAccount Expiry is a PowerShell script that allows AD Admins to export into the Script's Current Directory a CSV report on Active Directory Accounts that are Expired, Expiring within 2 weeks, and/or Disabled.. + +## Prerequisites + +Before you begin, ensure you have met the following requirements: +* PowerShell with the [ActiveDirectory](https://docs.microsoft.com/en-us/powershell/module/activedirectory/?view=windowsserver2022-ps) module installed (Windows only). +* Proper permissions granted by your Admin. + +## Installing ADAccount Expiry + +To install ADAccount Expiry, follow these steps: + +* Download the release Source code and place the contents into folder at a location of your choosing. + +## Using ADAccount Expiry + +To use ADAccount Expiry, follow these steps: + +``` +- Run the script in PowerShell +- The report will be exported to the current directory +- Open the CSV in Excel +- File > Save As . change extension dropdown to "*.xlsx" > Save +- You may now apply any formatting/editing to the report prior to submitting it +``` + +This project uses the following license: [Unlicense](https://unlicense.org). diff --git a/adaccount-expiry/ROADMAP.md b/adaccount-expiry/ROADMAP.md new file mode 100755 index 0000000..c9ab325 --- /dev/null +++ b/adaccount-expiry/ROADMAP.md @@ -0,0 +1,4 @@ +# Roadmap + +* Add ability to email results upon completion of script +* Add ability to automate running of script on schedule diff --git a/check-free-space/Check-Free-Space.ps1 b/check-free-space/Check-Free-Space.ps1 new file mode 100755 index 0000000..baa1ec3 --- /dev/null +++ b/check-free-space/Check-Free-Space.ps1 @@ -0,0 +1,20 @@ +$servers = @("HOSTNAME") + +Foreach ($server in $servers) +{ + $disks = Get-WmiObject Win32_LogicalDisk -ComputerName $server -Filter DriveType=3 | + Select-Object DeviceID, + @{'Name'='Size'; 'Expression'={[math]::truncate($_.size / 1GB)}}, + @{'Name'='Freespace'; 'Expression'={[math]::truncate($_.freespace / 1GB)}} + + $server + + foreach ($disk in $disks) + { + $disk.DeviceID + $disk.FreeSpace.ToString("N0") + "GB / " + $disk.Size.ToString("N0") + "GB" + + } + } + +# /Update on Dec 9, 2019/ +# Note that moving forward, future PowerShell versions no longer support Get-WmiObject so if all of a sudden you see the error message like “RPC Server is unavailable”, it’s probably time to switch over to Get-CimInstance instead. The parameters are the same for Win32_LogicalDisk. Simply replace Get-WmiObject with Get-CimInstance and you are good to go. diff --git a/check-free-space/README.md b/check-free-space/README.md new file mode 100755 index 0000000..5c503e3 --- /dev/null +++ b/check-free-space/README.md @@ -0,0 +1,29 @@ +# Check Free Space PS Script v22.01.1 + +Check Free Space is a PowerShell script that allows AD Admins to check the used/max HDD space on all drives on a remote PC on the domain. + +## Prerequisites + +Before you begin, ensure you have met the following requirements: +* PowerShell with the [ActiveDirectory](https://docs.microsoft.com/en-us/powershell/module/activedirectory/?view=windowsserver2022-ps) module installed (Windows only). +* Proper permissions granted by your Admin. + +## Installing Check Free Space + +To install Check Free Space, follow these steps: + +* Download the release Source code and place the contents into folder at a location of your choosing. + +## Using Check Free Space + +To use Check Free Space, follow these steps: + +``` +- Open the script in a notepad program +- Enter the hostname of the target PC in the "HOSTNAME" field, replacing the word already there +- Save the file +- Run the script in PowerShell +- The results will be printed out in the terminal +``` + +This project uses the following license: [Unlicense](https://unlicense.org). diff --git a/check-free-space/ROADMAP.md b/check-free-space/ROADMAP.md new file mode 100755 index 0000000..6649c47 --- /dev/null +++ b/check-free-space/ROADMAP.md @@ -0,0 +1,3 @@ +# Roadmap + +* N/A