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 →
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 →
This post is heavily plagiarised from here. But sometimes I see an interesting nugget of code and like to make sure I never lose it, and this piece on charting for PowerShell is no different! I’ve made a few tweaks … Continue reading →
Selenium is a portable software-testing framework for web applications. It’s pretty cool (in a geeky way) and is primarily used to test web applications. In this instance we’re using it to launch Internet Explorer, load a web-based helpdesk dashboard on the intranet, log into … Continue reading →
I’ve been performing some SQL queries recently using PowerShell and Invoke-SqlCmd, but I’ve noticed that by default Invoke-Sqlcmd returns columns RowError and HasErrors. Here is a simple example of returning a list of devices (a single column of data) from … Continue reading →
A couple of days ago I wanted to check which products were installed on a computer using PowerShell. And throughout my journey I discovered how we can format the output of returned data by using Select-Object with PowerShell. Take this … Continue reading →