# Get ACL Permissions for a specific OU (Get-ACL "AD:$((Get-ADOrganizationalUnit -Identity 'OU=Computers,DC=Test,DC=LOCAL').distinguishedname)").access | Select IdentityReference,AccessControlType,ActiveDirectoryRights.IsInherited #Other examples available from https://www.easy365manager.com/how-to-document-ou-delegation/ https://shellgeek.com/get-ad-ou-permissions-report/
Query Active Directory – Security Script
PowerShell script to query active directory : Identify Accounts with Password expiring is disabled Identify Accounts have not logged on for 30 or 90 days and accounts have never logged…
Import Reg Key To Remote Computer
Challenge : Import reg key settings to a remote compute Requires WinRM to be running Execute as Administrator **This script worked when tested on a Window 2021 server to a…
Azure – Update Management
How to maintain the patch status of your Windows and Linux machines "You can use Update Management in Azure Automation to manage operating system updates for your Windows and Linux…
Ping sweep script test
POWERSHELL import-CSV "" | foreach { $result = Test-Connection -ComputerName $_.Name -Count 1 -Quiet $_.name, $result -join ',' | out-file "c:\scripts\PingSweep\computer_results.txt" -Append } COMMAND /BATCH SCRIPT Create list of computers…
If Not Exists – Batch Script
Create a batch file to check a text file is in the location specified, else run a task. #This batch file checks to see if a text file is…
How To Access A SQL Server 2008 Databases WITHOUT SA (SysAdmin) Credentials
Challenge : How to make a backup of a SQL 2008 database without knowing any working credentials. Log on to the Windows 2008 R2 server running SQL Server 2008 as…
Get a list of active users which have logged on to the domain in the last 7 days
# Get a list of users which have logged on to the domain in the last 7 days $Date = (Get-Date).AddDays(-7) Get-ADUser -Filter {LastLogonDate -gt $Date} | Select distinguishedName
Robocopy. Copy Move Files Older or Newer than X number of days
Script options Move only files under 60days old Move files older than 60days Move files back Move files older than 182 is number of days (6 months roughly) Move only…
WSUS and Windows 10 Clients – UsoClient.exe
So, you deploy a GPO to Window 10 clients, but your in a hurry to get the clients to check in... As a SysAdmin for many years I would log…