If you have an Organizational Unit (OU) in Active Directory (AD) containing a large number of users, and you need to ensure these users are not members of any other groups, or perhaps that they are only members of certain groups, I’ve put a PowerShell script together for this purpose. It allowed me to quickly…
Azure – Fixing AAD Connect Sync Not Starting Post-Reboot
Some months ago, a problem was noticed with one of our servers that hosts the Azure AD Connect Sync service. After a reboot, the service did not automatically start back up as expected; and, upon further inspection, the synchronization from Azure > on-prem domain was not functional. In troubleshooting this issue, I took to the…
PowerShell – Extract Text From .PDF Files
A unique challenge presented itself the other day- to extract text from .PDF files. I found the iText-based PSwritePDF module in the PowerShell Gallery that offers this capability; however, I found it to be an incomplete solution due to the fact that many .PDF files (particularly those created with an automated tool, like GhostScript or…
PowerShell – Get Uninstall String Info from Registry
I’ve put together a simple function to extract the Uninstall String information from the Windows Registry. This is convenient for identifying the binary location and arguments to uninstall a given win32 application. Or, if the application was installed with a .msi file, the product code will often be specified – which, of course, can be…
PowerShell – Get Additional Application Info
The common method used to return win32 application information from a Windows device via PowerShell is ‘gwmi win32_product.’ This returns the more pertinent IdentifyingNumber, Name, Vendor, Version, and Caption properties, as shown in the below example output. However, Windows does have more information on these applications. Using the ‘wmic product get’ command, we can get…
PowerShell – Get AD User’s Last Logon Time
Here’s a simple little function I put together that will accept a user’s name in First Last format, and then return their last logon time information from AD. Here is the GitHub link: https://github.com/p8nflnt/SysAdmin-Toolbox/blob/main/Get-AdUserLogonTime.ps1
PowerShell – Send Email Notifications for VPN Connectivity Loss & Restoration
I’ve put together a simple script to perform a ping test against an endpoint across a VPN connection to confirm VPN connectivity. If the endpoint can’t be pinged, it sends an email notification to your desired internal email address. I’ve built in a notification interval so that you are not spammed with notification emails. And,…
PowerShell – Get Windows Host Info with PsExec
Over the past several days, I have been exploring the idea of retrieving information for diagnostic purposes from Windows hosts using PsExec of the Sysinternals suite. This is something that might make sense for a small environment, as it is clientless, and there is really no overhead besides the lightweight PsExec tool, and the ThreadJob…
PowerShell, Reddit, Confetti, and Rick Astley
The other day, I came across this Reddit post on r/sysadmin: https://reddit.com/r/sysadmin/s/FkC30bMxCJ The OP explains that his CEO has requested that he make confetti appear on everyone’s screen simultaneously to celebrate a milestone. I found the absurdity of the request hilarious. And, I took it as a challenge to script something similar- but I took…
PowerShell – Convert PsExec-run Cmdlet Output Strings Back to Objects, Properties, & Values
I have been experimenting with using PsExec of the Sysinternals suite to gather information from remote Windows systems for diagnostic use. I’ve found it to be a powerful tool, especially when integrated with PowerShell scripts. It is able to execute a script or command on a remote machine and return the output back to the…