Skip to content

Instantly share code, notes, and snippets.

using namespace System.Collections.Generic
using namespace System.Management.Automation
using namespace System.Security.AccessControl
using namespace Microsoft.Win32
function Get-InstalledSoftware {
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
#source of the main script : "https://gist.github.com/indented-automation/32efb05a5fb67ef9eed02bbb8fe90691"
#source of the Regex filtering : "https://github.com/gangstanthony/PowerShell/blob/master/Get-InstalledApps.ps1"
filter Get-InstalledSoftware {
<#
.SYNOPSIS
Get all installed from the Uninstall keys in the registry.
.DESCRIPTION
Read a list of installed software from each Uninstall key.
@HumanEquivalentUnit
HumanEquivalentUnit / Invoke-WithImpersonation.ps1
Created August 12, 2020 05:05 — forked from jborean93/Invoke-WithImpersonation.ps1
Invoke a scriptblock in powershell with impersonation
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Add-Type -Namespace PInvoke -Name NativeMethods -MemberDefinition @'
[DllImport("Kernel32.dll")]
public static extern bool CloseHandle(
IntPtr hObject);
[DllImport("Advapi32.dll", SetLastError = true)]
public static extern bool ImpersonateLoggedOnUser(