Skip to content

Instantly share code, notes, and snippets.

View kilasuit's full-sized avatar

Ryan Yates kilasuit

View GitHub Profile
@kilasuit
kilasuit / Install-PowerShell.ps1-enhanced-Readme.md
Last active September 20, 2023 01:44
Examples of using the install-powershell.ps1 script from the PowerShell Repo
@kilasuit
kilasuit / InstallPwsh-StableOrPreview.ps1
Last active September 26, 2023 05:52
Some functions out of my setup script for installing Pwsh & PwshPreview via Microsoft update
function Install-PwshPreview {
$pwshRegPath = "HKLM:\SOFTWARE\Microsoft\PowerShellCore"
$previewPath = Join-Path -Path $pwshRegPath -ChildPath "InstalledVersions\39243d76-adaf-42b1-94fb-16ecf83237c8"
if (!(Test-Path -Path $previewPath)) {
$null = New-Item -Path $previewPath -ItemType Directory -Force
}
Set-ItemProperty -Path $pwshRegPath -Name UseMU -Value 1 -Type DWord
Set-ItemProperty -Path $previewPath -Name Install -Value 1 -Type DWord
}
function Install-Pwsh {
@kilasuit
kilasuit / idletasks.txt
Created March 2, 2023 05:18
idle tasks
read
https://www.igorslab.de/en/amd-ryzen-9-7950x3d-gaming-and-workstation-review/
& it suggests this
%windir%system32rundll32.exe advapi32.dll,ProcessIdleTasks
@kilasuit
kilasuit / InstallModules.ps1
Created February 21, 2023 15:59
Install modules using module pinning without PSDepend
$modules = @(
@{Name = 'az'; RequiredVersion = '8.0.0' }
@{Name = 'BetterCredentials'; RequiredVersion = '4.5' }
@{Name = 'Configuration'; RequiredVersion = '1.5.0' }
@{Name = 'EditorServicesCommandSuite'; RequiredVersion = '0.4.0' }
@{Name = 'ExchangeOnlineManagement'; RequiredVersion = '2.0.3'}
@{Name = 'ISESteroids'; RequiredVersion = '2.7.1.9'}
@{Name = 'ISE_Cew'; RequiredVersion = '0.1.10'}
@{Name = 'Lability'; RequiredVersion = '0.20.0' }
@{Name = 'Microsoft.PowerShell.SecretManagement'; RequiredVersion = '1.1.1' }
@kilasuit
kilasuit / attemptedfix.ps1
Created January 16, 2023 16:04
Guildwars scripts minus keys
#$ErrorActionPreference = 'SilentlyContinue'
$accounts = @(
[PSCustomObject]@{
AccountName = 'Account1'
Token = ""
}
[PSCustomObject]@{
AccountName = 'Account2'
Token = ""
}
@kilasuit
kilasuit / WebsiteAccess.ps1
Last active February 2, 2022 23:52
functions for enabling/disabling Website access via hosts file.
#Requires -RunAsAdministrator
#Requires -Module @{ ModuleName = 'PSHosts';
RequiredVersion = '1.2.2' }
Function New-WebSiteHostEntry {
[CmdletBinding()]
[Alias('NWA')]
param (
# Parameter help description
[Parameter()]
## this is a comment
$ echo this is a command
this is a command
## edit the file
$vi foo.md
+++
date = "2014-09-28"
title = "creating a new theme"
+++
@kilasuit
kilasuit / replaceme.ps1
Last active January 7, 2022 11:19
PowerApps nonsense powershell fix
function Get-AdminPowerAppsUserDetails
{
<#
.SYNOPSIS
Downloads the user details into specified filepath
.DESCRIPTION
The Get-AdminPowerAppsUserDetails downloads the powerApps user details into the specified path file
Use Get-Help Get-AdminPowerAppsUserDetails -Examples for more detail.
.PARAMETER UserPrincipalName
The user principal name
@kilasuit
kilasuit / get-nexttrain.ps1
Last active December 14, 2021 03:57
Simple get next train function
function Get-NextTrain {
$from = "MAN"
$to = "MAC"
$date = Get-date -Format ddMMyy
$time = Get-date -Format HHmm
$url = "http://ojp.nationalrail.co.uk/service/timesandfares/$from/$to/$date/$time/dep/"
start iexplore $url
}
@kilasuit
kilasuit / PnP Content type to Site Design.ps1
Created November 11, 2021 13:30
PnP Content type to Site Design
$tenant = "myo365tenant"
$SiteURL = "https:://$tenant.sharepoint.com/sites/contenttypehub"
$group = 'Custom Content Types'
Connect-PnPOnline -url $SiteUrl -Interactive
Get-PnPContentType | Where Group -eq $group | Foreach {
@"
{
"verb": "addContentType",
"name":"$_"