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 →
This PowerShell script will list certificates for local machine and current user certificate stores. get-childitem -Path Cert:\ | foreach-object ({ $location = $_.Location foreach($store in $_.StoreNames.Keys) { get-childitem -Path “Cert:\$location\$store” | foreach-object ({ $thumb = $($_.ThumbPrint) $issuer = $($_.Issuer) write-host … Continue reading →
Sometimes in a batch file we need to wait for a service to stop in a batch file before we continue to processing our script. NET STOP will only wait a finite amount of time for a service to stop, … Continue reading →
Sometimes when we’re debugging an application we might want to ensure that every DLL (or OCX) is registered correctly. And rather than registering each assembly manually we can write a batch file to register or unregister DLLs in a folder: … Continue reading →
Here’s a script that will check if a windows update exists on a device. Yes, there are manual ways of finding out by navigating to Control Panel > Programs and Features > View Installed Updates, but sometimes it’s quicker to … Continue reading →
I was working on an application migration recently, and wanted to see how many users/computers were in each application Active Directory (AD) group in a specified Organisational Unit (OU). I wrote a PowerShell script to find the membership count of … Continue reading →