Skip to content

Instantly share code, notes, and snippets.

View mwallner's full-sized avatar
🧙

Manfred Wallner mwallner

🧙
View GitHub Profile
@mwallner
mwallner / Install-SCCMUpdates.ps1
Last active November 21, 2023 02:42
install all available updates via SCCM
<#
.SYNOPSIS
Install all updates available via SCCM and WAIT for the installation to finish.
.PARAMETER Computer
the computer to install updates on
.OUTPUTS
a object containing information about the installed updates and the reboot state (if a reboot is required or not)
@mwallner
mwallner / fzf-posh.md
Created September 27, 2019 09:15
using fzf to nagive directories in PowerShell

using fzf to nagive directories in PowerShell

simplest way: 1-liner

Set-Location (Get-Item $(fzf)).Directory.FullName

creating a function

@mwallner
mwallner / boxstarter_host_setup.ps1
Last active July 30, 2023 19:14
psconfeu23_hostsetup
# NuGet package provider. Do this early as reboots are required
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Write-Host "Install-PackageProvider"
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope AllUsers -Confirm:$False
# Exit equivalent
Invoke-Reboot
}
<#
.SYNOPSIS
BoxStarter script to configure Windows 10 development PC.
.DESCRIPTION
You might need to set:
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy Bypass
@mwallner
mwallner / chronotags.ps1
Created March 15, 2023 09:39
chronologically sort git tags by commit-date
git tag -l --format="%(refname) :: %(if)%(committerdate:iso)%(then)%(committerdate:iso)%(else)%(*committerdate:iso)%(end)" | % {($r,[datetime]$t)=$_.Split("::"); @{r=$r;t=$t}} | Sort t | Select r
@mwallner
mwallner / setup-vm-winhost.ps1
Created June 13, 2022 21:12
WIndows VM Base pwsh and SSH Remoting
choco install pwsh -y
choco install ripgrep -y
choco install vscode -y
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH*'} | Add-WindowsCapability -Online
Start-Service sshd
Set-Service sshd -StartupType Automatic
Stop-Service sshd
@mwallner
mwallner / boxstarter-bootstrapper.md
Created February 3, 2020 19:53
using Boxstarter to overcome PowerShell v2 on Box deployments

using Boxstarter to overcome PowerShell v2 on Box deployments

Preparation (on a random host)

  • Install Chocolatey
  • choco install boxstarter -y
  • open "Boxstarter Shell"
  • create "Portable Boxstarter" see wiki
@mwallner
mwallner / cmdlettest.ps1
Created January 14, 2020 21:26
powershell cmdet vs basic function argument handling
function Get-EvilCmdLet {
[CmdletBinding()]
param(
[ValidateSet('A', 'B')]
$Category
)
Write-Output "= Get-EvilCmdLet ="
Write-Output "* PSBoundParameters"
$PSBoundParameters.Keys | % {
@mwallner
mwallner / Add-TrustedHostDownloadSite.ps1
Created February 11, 2020 16:39
when using a offline VisualStudio layout, you need to ensure the host you're downloading from is "trusted"
function Add-TrustedHostDownloadSite {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$ServerName,
[Parameter(Mandatory = $false)]
[string]$Domain = "myorg.somedomain"
)
Push-Location
@mwallner
mwallner / Get-LatestProcesses.ps1
Created March 20, 2019 10:47
get 'youngest' process with some filter possibilites
param(
[Parameter(Mandatory = $False)]
[int]$NumberOfProcesses = 1,
[Parameter(Mandatory = $False)]
[switch]$IncludeMicrosoftProcesses,
[Parameter(Mandatory = $False)]
[switch]$RequirePath,