Skip to content

Instantly share code, notes, and snippets.

@Nevember
Nevember / Touch-File.ps1
Created May 15, 2022 22:50 — forked from mklement0/Touch-File.ps1
PowerShell function that provides functionality similar to the Unix touch utility for updating last-modified file timestamps and creating files on demand.
<#
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/82ed8e73bb1d17c5ff7b57d958db2872/raw/Touch-File.ps1 | iex
#Install WinGet
#Based on this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
"Installing winget Dependencies"
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@Nevember
Nevember / toast.ps1
Created September 12, 2021 23:56 — forked from dend/toast.ps1
Toast Notification in PowerShell
function Show-Notification {
[cmdletbinding()]
Param (
[string]
$ToastTitle,
[string]
[parameter(ValueFromPipeline)]
$ToastText
)
@Nevember
Nevember / powershell.json
Created June 28, 2021 04:46 — forked from rkeithhill/powershell.json
PowerShell snippets file for Visual Studio Code - place in your ~\AppData\Roaming\Code\User\Snippets directory
{
"Condition statement": {
"prefix": "cond",
"body": [
"${_} { ${0}; break }"
],
"description": "Switch condition statement"
},
"Condition single quoted string statement": {
@Nevember
Nevember / Lookup CLSID in PowerShell
Last active June 6, 2021 05:35 — forked from brad-anton/Lookup CLSID in PowerShell
Look up information for multiple CLSIDs; pipeline input is a work-in-progress
Function Get-Clsid {
[CmdletBinding()]
param (
[Parameter (Mandatory=$true,Position=0,ValueFromPipeline=$true)]
[Array]$CLSID
)
$CLSID_KEY = "HKLM:\SOFTWARE\Classes\CLSID"
$ErrorActionPreference = 'SilentlyContinue'