Skip to content

Instantly share code, notes, and snippets.

View popeen's full-sized avatar
📎

Patrik Johansson popeen

📎
View GitHub Profile
@popeen
popeen / New-PopsFakeProgram.ps1
Created February 2, 2023 21:27
Sometimes it can be useful for sysadmins to create fake programs in the Programs & Features list (appwiz.cpl) on Windows. This script will make doing so very easy. See my blogpost about this at https://scriptingnerd.com/2020/03/13/use-powershell-to-create-a-fake-program-in-the-programs-and-features-list-for-indexing-purposes
Function New-PopsFakeProgram {
<#
.SYNOPSIS
Add a fake program to programs & features
.DESCRIPTION
Add a fake program to programs & features
.PARAMETER Name
The internal name
.PARAMETER DisplayName
The name that should be shown
@popeen
popeen / BulkImportBooksonicUsers.ps1
Created November 4, 2021 16:15
powershell script to bulk import users into booksonic from a csv file
$useHttps = $false
$serverAddress = "demo.booksonic.org"
$serverPort = "80"
$adminUsername = ""
$adminPassword = ""
$csvPath = "C:\path\to\users.csv"
$csvDelimiter = ";" #Change to , if that is what your csv use. Excel usually uses ;
@popeen
popeen / Set-ExplorerMenuStyle.ps1
Created October 12, 2021 18:31
Allows you to switch between the modern (w11/command bar) and classic (ribbon) menu in explorer on windows 11
function Set-ExplorerMenuStyle{
param(
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true,
Position=0
)]
[ValidateSet("Classic", "Modern", "Ribbon", "CommandBar")]
[String]
@popeen
popeen / Set-ContextMenuStyle.ps1
Last active September 29, 2022 23:55
Allows you to switch between the modern (w11) and classic style context menu in windows 11
function Set-ContextMenuStyle{
param(
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true,
Position=0
)]
[ValidateSet("Classic", "Modern")]
[String]
@popeen
popeen / gist:970c42d5f2f44b61990feee286ac63d6
Created October 6, 2020 09:33
Create a WinPE environment with powershell and swedish keyboard
copype amd64 C:\WinPE_amd64
dism /Mount-Image /ImageFile:C:\WinPE_amd64\media\sources\boot.wim /index:1 /MountDir:C:\WinPE_amd64\mount
dism /Image:C:\WinPE_amd64\mount /Set-InputLocale:041d:0000041d
dism /image:C:\winpe_amd64\mount /add-package /packagepath:"\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"
dism /image:C:\winpe_amd64\mount /add-package /packagepath:"\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX.cab"
dism /image:C:\winpe_amd64\mount /add-package /packagepath:"\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab"
@popeen
popeen / ConvertLibraryToMp3.ps1
Last active October 5, 2020 21:47
Convert entire Booksonic library from m4a/m4b to mp3
Get-ChildItem "K:\Ljudbocker" -Recurse -Include *.m4b, *.m4a|ForEach-Object{
$before = $_.FullName
$after = $_.FullName.replace($_.Extension, ".mp3")
ffmpeg -i $before -acodec libmp3lame $after
Rename-Item -Path $before -NewName "$($before).old"
#Remove-Item -Path $before
}