Skip to content

Instantly share code, notes, and snippets.

@TheBigBear
TheBigBear / WinGet_WinSrv.ps1
Created July 21, 2023 07:50 — forked from likamrat/WinGet_WinSrv.ps1
Installing Winget om Windows Server 2019/2022
Write-Information "This script needs be run on Windows Server 2019 or 2022"
If ($PSVersionTable.PSVersion.Major -ge 7){ Write-Error "This script needs be run by version of PowerShell prior to 7.0" }
# Define environment variables
$downloadDir = "C:\WinGet"
$gitRepo = "microsoft/winget-cli"
$msiFilenamePattern = "*.msixbundle"
$licenseFilenamePattern = "*.xml"
$releasesUri = "https://api.github.com/repos/$gitRepo/releases/latest"
@TheBigBear
TheBigBear / Readme.md
Last active June 24, 2023 11:41
Error: Unable to load one or more of the requested types.

and after trying to upgrade to 2.0.0 from 1.4.0 I got the following error now on one machine?

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

The logs show what happens if i start just choco or choco --version or choco list basically anything at all it does not seem to start chocolatey but instead shows me that one error line above.

@TheBigBear
TheBigBear / windows_openssh_authorized_keys_acl.ps1
Created July 26, 2022 17:37 — forked from scivision/windows_openssh_authorized_keys_acl.ps1
Set permissions ACL for Windows OpenSSH administrators_authorized_keys
# this script is copied from:
# https://www.concurrency.com/blog/may-2019/key-based-authentication-for-openssh-on-windows
# Script by Mitchell Grande of Concurrency.com
#
$acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys
$acl.SetAccessRuleProtection($true, $false)
$administratorsRule = New-Object system.security.accesscontrol.filesystemaccessrule("Administrators","FullControl","Allow")
$systemRule = New-Object system.security.accesscontrol.filesystemaccessrule("SYSTEM","FullControl","Allow")
$acl.SetAccessRule($administratorsRule)
$acl.SetAccessRule($systemRule)
@TheBigBear
TheBigBear / gist:1d2369d3b353a452bb3b76a805b24d3d
Last active May 12, 2021 14:24
scripting ms o365 'file request' using powershell to use a 'any' anonymous link to upload a file to onedrive folder
Can anybody help me write a powershell function that takes three parameters
and uploads a specified file usnig the file request URL.
'firstname' 'lastname' and 'file'to stuff in the web file upload request.
MS 'file request' uploads are explained here:
https://support.microsoft.com/en-us/office/create-a-file-request-f54aa7f8-2589-4421-b351-d415fc3b83af
And one such 'test' file request is here:
@TheBigBear
TheBigBear / gist:890f9cc7944058c415f03e6221d7c275
Last active June 12, 2020 14:31
howto assign variable from ps
# want to switch from old method using Get-MailboxStatistics cmdlet to using Export-MailboxDiagnosticLogs instaed
# as shown at ( https://petri.com/exchange-online-exposes-new-mailbox-activity-data )
#old method using Get-MailboxStatistics cmdlet
$UserReport = New-Object PSObject
# check for mailbox info
foreach ($mbx in $mbxs) {
if ($user.UserPrincipalName -eq $mbx.UserPrincipalName) {
$mbxstats = Get-MailboxStatistics -Identity $mbx.UserPrincipalName -ErrorAction SilentlyContinue | Select LastUserActionTime,LastLogonTime,SystemMessageSize
$LastUserActionTime = $mbxstats.LastUserActionTime
@TheBigBear
TheBigBear / basic-1.cmd
Created August 28, 2019 14:34
test of basic windows install
#!/bin/sh
mkdir c:\tmp
mkdir c:\temp
cd c:\temp
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
cmd /c powershell choco install boxstarter
@TheBigBear
TheBigBear / Install-Programs
Created August 19, 2019 15:11
A Chocolatey PowerShell script to install programs to a newly paved Windows 8 machine, including development tools. Based on a gist from @amogram (https://gist.github.com/amogram/8217460)
# ==========================================================================
#
# Script Name: Install-Programs.ps1
#
# Author: Andy Parkhill
#
# Date Created: 27/03/2014
#
# Description: A simple environment setup script for my personal laptop.
#
@TheBigBear
TheBigBear / boxstarter.ps1
Created August 19, 2019 15:10
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
# OR
# Description: Techsnips-Repave Script
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
# OR
@TheBigBear
TheBigBear / Techsnips-Docker-Env-Setup
Created August 19, 2019 15:09
Techsnips-Docker-Env-Setup
# Description: Techsnips-Docker-Env-Setup
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
# OR