Rebuilt repo, added commands, cleadned formatting
This commit is contained in:
parent
af4b30c6e9
commit
b79d3648be
11 changed files with 179 additions and 73 deletions
24
ps-scripts/ad-account-expiry/README.md
Executable file
24
ps-scripts/ad-account-expiry/README.md
Executable file
|
@ -0,0 +1,24 @@
|
|||
# AD Account Expiry PS Script
|
||||
|
||||
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..
|
||||
|
||||
<br>
|
||||
|
||||
### 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.
|
||||
|
||||
<br>
|
||||
|
||||
### Using ADAccount Expiry
|
||||
|
||||
To use AD Account Expiry, follow these steps:
|
||||
|
||||
1. Download the `ad-account-expiry` folder and place at a location of your choosing
|
||||
2. Run the script in PowerShell
|
||||
3. The report will be exported to the current directory
|
||||
4. Open the CSV in Excel
|
||||
5. File > Save As . change extension dropdown to "*.xlsx" > Save
|
||||
6. You may now apply any formatting/editing to the report prior to submitting it
|
7
ps-scripts/ad-account-expiry/ad-account-expiry.ps1
Executable file
7
ps-scripts/ad-account-expiry/ad-account-expiry.ps1
Executable file
|
@ -0,0 +1,7 @@
|
|||
# AD Account Expiration Script
|
||||
|
||||
$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
|
30
ps-scripts/check-free-space/README.md
Executable file
30
ps-scripts/check-free-space/README.md
Executable file
|
@ -0,0 +1,30 @@
|
|||
# Check Free Space PS Script
|
||||
|
||||
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.
|
||||
|
||||
<br>
|
||||
|
||||
## 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.
|
||||
|
||||
<br>
|
||||
|
||||
### Using Check Free Space
|
||||
|
||||
To use Check Free Space, follow these steps:
|
||||
|
||||
1. Download the `check-free-space` folder and place at a location of your choosing
|
||||
2. Open the script in a notepad program
|
||||
3. Replace $hostname with the hostname of the target PC
|
||||
4. Save the file
|
||||
5. Run the script in PowerShell
|
||||
6. The results will be printed out in the terminal
|
||||
|
||||
<br>
|
||||
|
||||
### Notes
|
||||
|
||||
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.
|
19
ps-scripts/check-free-space/check-free-space.ps1
Executable file
19
ps-scripts/check-free-space/check-free-space.ps1
Executable file
|
@ -0,0 +1,19 @@
|
|||
# Check Free Space Script
|
||||
|
||||
$servers = @($hostname) # Replace $hostname with the computer's 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"
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue