This post provides examples of how we can manipulate Active Directory user accounts using the ADSI Searcher instead of the ActiveDirectory PowerShell Module. Most Google searches provide examples that use the PowerShell ActiveDirectory module cmdlets such as Get-ADUser and Get-ADComputer. … Continue reading →
Below is a quick example of how we can insert a VBScript custom action into a Windows Installer (MSI) using PowerShell. Remember that this example does not add the entry into the InstallExecuteSequence table, which will be required to actually … Continue reading →
Have you ever looked at the target of an .lnk shortcut and it appears to be greyed out/disabled? Chances are it is a Windows Installer advertised shortcut, which is used as part of Windows Installer resiliency and self healing. Instead … Continue reading →
I often write administrative scripts and am required to send an email using PowerShell. There are a couple of ways to do this depending on our objectives. If we just require an email then I opt to use the Send-MailMessage … Continue reading →
I’ve been running an audit on Active Directory (AD) recently, with a view to sending emails to multiple users based on AD group membership. Rather than sending a separate email to each user in an AD group (adding load to … Continue reading →
Sometimes when writing PowerShell scripts we encounter an issue where PowerShell cannot locate UNC paths correctly. PowerShell Cannot Locate UNC Paths Take the following chunk of code; make sure you change the UNC path to a valid path, and run … Continue reading →
This blog post shows code that can be used when installing and uninstalling an MSI using PowerShell. You can adapt the code to add more parameters (public properties etc) as necessary. You can use this chunk of PowerShell code to … Continue reading →
This simple chunk of code will find newly launched processes (specifically their process IDs) that have started between a given period: $existingProcessPids = Get-Process -ErrorAction SilentlyContinue | Select -ExpandProperty Id #new processes launched here start-process notepad.exe start-process cmd.exe $newProcessIds = … Continue reading →
This blog post proposes a consistent method of obtaining the current working directory using PowerShell, whether your scripts are embedded inside an executable or not. Obtaining the Current Working Directory using PowerShell I tend to use a great tool called … Continue reading →
Sometimes when we’re debugging certificates on a Microsoft Windows operating system, we want to be able to quickly see what store a certificate belongs to. This PowerShell script will list certificates for the local machine and current user certificate stores. … Continue reading →