Version 2019.01 to 2019.07 (Released 2019.07.07)
- Bug Fix: Remote SQL server permissions issue on applying the correct permissions.
- Remote SQL servers: Enhanced the Security Awareness Alert to explain what is needed, and automatically check to see if modifications are required. If required, it will make them. If not, it will let you know that no changes were made.
- Raised minimum PowerShell requirements to PowerShell 4.0 or higher. Put in a hard stop if the requirement is not met.
- Changed all logging variables to arrays for much faster processing.
- Add Application Pool Memory to the HelpMe output.
- Added code to make the HelpMe output cleaner.
- Added security to mail server authentication details. The system now uses Get-Credential to ask and securely store authentication details in AES encrypted TXT files on disk. If plain text authentication is stored in the configuration file, a warning will appear on every run in the console output only.
- Added a new error-wrapping around sending emails. If the sending of emails fails, WAM will fall back to saving a TXT file log. Details of the error are prepended to the TXT log and outputted to the console for troubleshooting.
- Added an upgrade check to the installer.
- Added a new stream – Rename OS Descriptions – which will rename OS descriptions to a more detailed and friendly descriptive name.
- Documentation updates.
- Added /? to the installer.
Version 3.5 to 2019.01 (Released 2019.01.28)
- Expanded the installer to include a GUI for the advanced options for easier adjustments.
- Expanded the installer to include a silent install mode for deployment on multiple systems. Please see the documentation for configuration options.
- Bug Fix: DirtyDatabaseCheck – issues with calling the Database Maintenance function after renaming it as well as throwing an error. This has been fixed.
- Bug Fix: RemoveDeclinedUpdates – Thanks to Taylor Ralston for the notice. When running the RemoveDeclinedUpdates switch on its own, it would not actually remove the updates but when run from ScheduledRun and QuarterlyRun, it would. This has been fixed.
- Clarification Fix: Added information to the DeclineMultipleTypesOfUpdates when it times out.
- Bug Fix: Refocused the Language pack removals to include LanguagePack.
- Documentation Update.
- New Feature: Added the ability of using a comma separated list of emails to send the report to.
- Bug Fix: Added verification checks that the SQLPS module is loaded before initiating the backup
- Further expanded the SQL Database Backup logic to check for the appropriate modules, auto-load them if necessary, and to account for any errors that may happen.
- Changed the SQL Database Backup to be off by default as you should have another method of backing the server and database up.
- Changed Get-WMIObject to Get-CimInstance to keep current as Get-WMIObject is deprecated.
- New Feature: Added the configuration ability of removing or not removing declined updates.
- Reordered RemoveDeclinedUpdates.
- Reordered RemoveDrivers.
- Crafted the SQL database name dynamically based on the registry.
- Bug Fix: Fixed InstallTask Remote SQL references to the SQL script.
- Expanded InstallTask for SQL Server with non-standard SQL ports.
- Expanded InstallTask for proper error handling of Remote SQL permissions and output.
- Bug Fix: Fixed WinXP and NonEnglishUpdates portions of the DeclineMultipleTypesOfUpdates stream.
- Bug Fix: Fixed one line that was missing off of the TXT output only on the DeclineMultipleTypesOfUpdates stream.
Version 3.2 to 3.5 (Released 2018.06.01)
- Re-branding of Adamj Clean-WSUS to AJTek’s WSUS Automated Maintenance (WAM) ©
- Added info to HelpMe
- Altered the entire script into a multi-file system, extracting each function, SQL script, and logic part into its own file.
- Manipulated the new SQL Scripts to adhere to the new system as some were being dynamically generated. Created parameter passing in these instances, condensing some of the SQL scripts.
- Expanded InstallTask to auto-create on systems running Server 2012 and lower that cannot create scheduled tasks through PowerShell using SchTask.exe instead.
- Expanded InstallTask’s SQL script on remote systems to include the code for previous versions of SQL (2005-2008) for adding the computer object’s account to the db_owner group.
- Created single installer for the entire system that allows for easy auto-configuration.
- Added ‘LOCALHOST’ as part of the possible SQL Server auto-detections, rather than just the <ComputerName>
- Bug Fix: DeclineMultipleTypesOfUpdates – The XP search was just searching ‘XP’ which was also triggering on eXPerience and others. Changed it to search for ‘ XP’ instead.
- Added Sharepoint Updates and ARM64 updates to the list of DeclineMultipleTypesOfUpdates.
- Added a frequency to DeclineMultipleTypesOfUpdates of either Daily or Monthly, for each individual set.
- Adjusted the RemoveObsoleteUpdates and CompressUpdateRevisions to run daily.
- Updated the URL Link to Microsoft KB Articles as Microsoft had changed this.
- Added AJTekSupersededUpdateDeclineAfterDays to allow for a delay of declining superseded updates. Thank you Brian Gleason for giving me this feature.
- Added -ErrorAction Stop to Get-WsusClassification which is what usually errors out if run on Server 2008.
- Bug Fix: Test-SQLConnection – added required escaped double quotes around the SqlServerName to account for non-standard SQL Server Ports (server,port). Thank you michaelschuler on Spiceworks for giving me this fix.
- Modified RemoveObsoleteUpdates and CompressUpdateRevisions to have better output including current time and delta times for each removal or compression.
- Re-configured DirtyDatabaseCheck to bring the queries and process more inline with Microsoft’s newest official method located on the KB3194588 page.
- Deprecated DirtyDatabaseCheck as Microsoft has changed the way they do things (for the better). It is still possible that you may need to run this switch but know that this will ALWAYS return a Dirty Database now due to the way Microsoft changed things.
- Re-enabled the erroring out of the script if the Automatic detection of the SQL Server fails to connect, which technically shouldn’t happen anymore.
- Renamed Prerequisites to System Requirements and re-adjusted the organization of the file accordingly. Made it easier to differentiate between what is recommended and minimum requirements.
- Added a configurable option for always displaying the WSUS DB Maintenance output in detail, rather than just on the ScheduledRunStreamsDay.
- On -SetApplicationPoolMemory, after changing the application pool memory, added a check to see if the application pool was in the stopped state and either started or restarted the application pool depending on what is required at the time.
- Added a check to see if the script times out while getting updates from the server into a variable. If this happens, it will continue on with the SQL queries to clean up and run the maintenance and will also alert you (in the console as well as in the log file) to re-run the -FirstRun switch up to 15 times. The idea is that the SQL queries will remove and optimize the database enough such that eventually getting all of updates from the server into a variable will be successful.
Version 3.1 to 3.2 (Released 2017.11.10)
- Bug Fix: Dirty Database Fix SQL Script to 1.1 – Added use SUSDB.
- Added EULA.
Version 3.0 to 3.1 (Released 2017.09.16)
- Spelling error on DirtyDatabaseCheck in ‘.EXAMPLE’.
- Clarify using apostrophes in the AdamjMailReportSMTPServerPassword variable.
- Prerequisite update to might need to change the encoding to ANSI – now that I’ve removed any non-ASCII Character in the script.
- Corrected English on DeclineMultipleTypesOfUpdates if using -FirstRun so that it says ‘today’ rather than the scheduled streams number.
- Bug Fix: Change $AdamjWSUSServer to check to see if it’s part of a domain, and if so, add the domain, otherwise use the hostname.
- Bug Fix: Revert Drivers SQL Removal back to 1.0 – 1.1 was causing errors killing the script from running.
Version 2.11 to 3.0 (Released 2017.09.01)
- NOTICE TO PREVIOUS USERS: Updated the description for RemoveDeclinedWSUSUpdates. Please read it.
- Added Test-IfBlocked – If it’s blocked, it will unblock it.
- Changed the behaviour of -InstallTask to remove the ExecutionPolicy as it will be auto-unblocked.
- BUG FIX: Changed -InstallTask to work with 6.2 which is Server 2012.
- Added DirtyDatabaseCheck – Checks to see if your database is in a bad state. If it’s in a bad state it fixes it.
- Changed WSUS Server variables to automatically pull from the registry entries. It should be fully automatic now for 99% of all cases.
- Added AdamjScriptVersion primarily for the -HelpMe stream for easier version recognition.
- Added DeclineMultipleTypesOfUpdates to replace DeclineSupersededUpdates.
- Changed -IncreaseApplicationPoolMemory to -SetApplicationPoolMemory and made it allow 0 (unlimited) or a higher number.
- Rewrote the prerequisites for SBS for clarity.
- Rewrote the .DESCRIPTION, organized the description of the streams by how they are run, with manual ones at the bottom.
- Rewrote the Install-Task function and added it to -FirstRun.
- Replaced some double quotes into single quotes around the script.
- Re-designed the SQL Testing and created it to auto-detect from the Windows Registry. It should be fully automatic now for 99% of all cases.
- Added a bypass for the -HelpMe stream if it can’t connect to the WSUS Server, it will bypass and create the log file for help.
- Added WSUSIndexOptimization stream which will increase the speed of WSUS’s database processing by 1000-1500 times faster.
- Added options for running RemoveWSUSDrivers in FirstRun and in the other routines.
- Clarified the Remote SQL Server instructions with the scheduled task running. Thank you to Ross Anderson for the full solution instructions.
- On Remote SQL Databases, setup the Scheduled Task to run as NT AUTHORITYSYSTEM and add the DOMAINCOMPUTER$ account to db_owner on only the SUSDB database.
- Added fix for spaces in the file or path name with regards to creating the scheduled task.
- Expanded the RemoveWSUSDriversSQL script to version 1.1 by adding new tables to check/resolve issues from.
- Ran some regular expression searches to remove any non-ASCII characters within the script and remove trailing tabs and spaces.
Version 2.10 to 2.11 (Released 2017.05.11)
- Re-organized Run switches.
- Added a Restart of the Application pool if you increase the application pool to make sure the settings take effect.
- Added logic to not connect to the WSUS server if not actually running something that requires it (Display & Increase the application pool and InstallTask).
- Added a configuration value for $AdamjScheduledTaskTime.
- Added a ComputerObjectCleanup Stream for more control over computer object removals.
- Cleaned up old commented code and spacing.
- Added and changed some commented code to verbose output.
Version 2.09 to 2.10 (Not Released)
- Added the Adamj Application Pool Memory Configuration Stream.
- Added information about Server 2016 at the prerequisites stage.
- Added Start-Transcript to -HelpMe stream as now everything is outputted to objects, not just Write-Host.
- Added Show-MyFunctions and Show-MyVariables and added them to the -HelpMe output instead of the contstraint to just Adamj Variables.
- Removed the Clean Up Variables section at the end. Once the script finishes running all variables within the script are destroyed as none are set globally.
- Changed $AdamjWSUSServer to auto-populate vs manual entry, along with changing it to lowercase within the script.
- Added comments for Gmail settings.
- Added comments in the SQL Server Variable section for the auto-detect issue on Server 2008 (R2).
- Added an SBS Section to the prerequisites.
- Created a function for Connect-WSUSServer.
- Created a function for -InstallTask and a check for powershell version 4 or higher within. Adjusted the Instructions at the top.
Version 2.08 to 2.09 (Not Released)
- Added CompressUpdateRevisions and RemoveObsoleteUpdates SQL Scripts as MonthlyRun items along with FirstRun.
- Added Configuration for Mail Report and Save Report options.
- Added Donation links.
- Fixed bug with running script from a folder with a space.
Version 2.07 to 2.08 (Not Released)
- Re-adjusted all Write-Host to Write-Output.
- Changed $AdamjScriptPath from split-path -parent $MyInvocation.MyCommand.Definition to Split-Path $script:MyInvocation.MyCommand.Path.
- Changed $VerbosePreference to “Continue” when executing -HelpMe.
- Added Begin, Process, End operators.
- Setup -HelpMe to change VerbosePreference to continue and change it back at the end to what it was before.
- Changed Test-Administrator to streamline the process.
- Changed SQL-Ping-Instance to Test-SQLConnection and cleaned up the code.
- Added some VERBOSE output throughout the script.
- Fixed a bug with $ExceptionError in the RemoveDeclinedWSUSUpdatesProceed function.
- Adjusted the prerequesites and added SQL Cmd line tools requirement with links.
- Fixed a bug with RemoveDeclinedWSUSUpdates, thanks to Nikolay Semov (Nikolay8159) from the Spiceworks forums.
- Added regions to each section for ease of modification and readability in PowerShell ISE and other editors.
Version 2.06 to 2.07 (Released 2016.10.05)
- Adjusted the prerequisites wording for clarity regarding the ANSI encoding.
Version 2.05 to 2.06 (Released 2016.07.08)
- Added notes regarding a Remote SQL connection such that you must use the computer account to run the script via Schedule Tasks.
- Added a -HelpMe Stream for getting troubleshooting data for support reasons.
- Check for for replica server and exclude only the DeclineSupersededUpdates as you can only decline superseded updates from the upstream server. Thanks to Jurriaan van Doornik for the help with testing and investigating.
- Adjusted the Timeout on the SQL-Ping Function to 60 seconds only if you specify the $AdamjSQLServer variable.
- Altered the Versioning notes layout for clarity and separation.
- Added a prerequisite of ANSI encoding for troubleshooting.
- Adjusted some of the descriptions of the streams information text to be more clear and consistent.
- Spelling and grammar fixes.
Version 2.04 to 2.05 (Released 2016.03.17)
- Tested on Server 2008 SP2, Server 2008 R2, Server 2012, and Server 2012 R2.
- Came up with installation instructions for prerequisites.
- Added code for detecting last day of the month if $AdamjScheduledRunStreamsDay is greater than the last day of the month, including leap years for months less than 31 days.
- Thank you to Malil for the initial base of the code for checking for $AdamjScheduledRunStreamsDay
Version 2.03 to 2.04 (Not Released)
- Fixed issue with SQL Connection command for issues with connecting to a Windows Server 2008 Internal Database.
- Fixed some visual issues with the TXT output relating to the duration.
- Clarified some instructional text at the top.
Version 2.02 to 2.03 (Not Released)
- Properly formatted running time duration to hh:mm:ss
- Added calculated duration of each stream, and total script duration.
- Removed a duplicated value in the setup configuration
Version 2.01 to 2.02 (Not Released)
- Malil helped troubleshooting further and I made code changes for $AdamjSQLServer on Server 2008.
- Added better email logs for the RemoveWSUSDriversSQL Stream. Added console messages to show that the script is still working and what it is doing as this stream will take time. Added console error message summaries, and file/email error message details.
- Changed Quarterly months defaults to 1, 4, 7, 10.
Version 2.00 to 2.01 (Not Released)
- Troubleshooting help by Malil from Spiceworks forums which lead to 2 small but significant code changes for the auto-detection of the $AdamjSQLServer variable, provided by Malil.
- Fixed the SCW to also account for hours run, rather than just minutes and seconds.
Version 1.5 to 2.01 (Not Released)
- Changed the mail function to allow for authentication, SSL, and SMTP Port
- Cleaned up the ‘Clean Up Variables’ section to account for all Adamj* Variables
- Added Clean Up WSUS Synchronization Logs Stream to keep the Sync logs clean
- Added SQL Auto-detect with function help from (http://stackoverflow.com/questions/11540445/how-to-verify-whether-the-sql-server-instance-is-correct-or-not-using-powershell)
- Redesigned pretty much the entire script into a function driven script.
- Added cmdlet options for running each section manually, or by way of the recommended time periods (Daily, Monthly, Quarterly)
- Added error checking and throwing better error messages on various things.
- Added Test-Administrator to confirm it is being run with elevated rights.
- Updated the Prerequisites and Instructions sections.
- Updated the output of the SCW.
Version 1.3 to 1.5 (Released 2015.07.16)
- Added the Adamj Remove Drivers Stream, Adamj Remove Declined WSUS Updates Stream, and the Adamj WSUS DB Maintenance Stream. Renamed the Adamj Bonus Cleanup Stream to Adamj Decline Superseded Updates Stream.
- Changed the formulation of the script into modular form. Now the script has 5 modular streams:
- WSUS Server Cleanup Wizard Stream
- Adamj Remove WSUS Drivers Stream
- Adamj Remove Declined WSUS Updates Stream
- Adamj WSUS 3.0 DB Maintenance Stream
- Adamj Decline Superseded Updates Stream.
Version 1.2 to 1.3 (Released 2015.07.09)
- Added the $AdamjBonusCleanupUpdatesCount variable to the output line on the declining updates message, so that a copy/paste can easily be done that shows how many updates were declined when it actually declines them.
Version 1.1 to 1.2 (Released 2015.07.06)
- Created the Adamj Bonus Cleanup Stream. Changed the output email into HTML and formatted the output nicely.
- Thanks to Rob Dunn from the Spiceworks forums for reviewing the code and making some suggestions on the code to help enumerate information better.
Version 1.0 to 1.1 (Not Released)
- Added “Diskspace Freed (GB)” from example code https://p0w3rsh3ll.wordpress.com/2015/01/26/cleanup-wsus/
- Re-formatted output of the email.
Version 1.0 - Initial Release (Released 2015.01.30)