With ConfigMan application deployments, it’s good practice to, when applicable, divide large groups up and take a staged approach at deployment. I’ve found myself multiple times creating multiple collections containing the objects within an Active Directory (AD) Organizational Unit (OU) for staged deployments. I decided to build a script to ease this process. This script…
Category: PowerShell
Posts pertaining to PowerShell scripting
PowerShell – Active Directory – Convert AD Name Formats
Many of the ActiveDirectory PowerShell module cmdlets expect the distinguished name format. I find this somewhat inconvenient, as this format does not read as nicely as the canonical name format that so many of us have become familiar with. Additionally, an objects’ canonical name is somewhat more readily available via the Active Directory Users and…
PowerShell – AD Cleanup – Get Extraneous Group Membership
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…
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…