Skip to content

Instantly share code, notes, and snippets.

View norman-bauer's full-sized avatar

Norman Bauer norman-bauer

View GitHub Profile
@norman-bauer
norman-bauer / Connect-Azure.ps1
Created May 3, 2023 20:21
Install and import Azure Module, then connect to Azure.
Install-Module -Name Az -AllowClobber -Scope CurrentUser
Import-Module Az
Connect-AzAccount
@norman-bauer
norman-bauer / AzureToFritzBoxVPN.cfg
Created May 3, 2023 19:33
Configuration file for FRITZ!Box to create a site-to-site VPN with Azure.
vpncfg {
connections {
enabled = yes;
conn_type = conntype_lan;
name = "AzureToFritzBoxVPN";
always_renew = no;
reject_not_encrypted = no;
dont_filter_netbios = yes;
localip = 0.0.0.0;
local_virtualip = 0.0.0.0;
@norman-bauer
norman-bauer / Create-AzureLocalNetworkGatewayUsingFQDN.ps1
Last active May 3, 2023 19:11
Create a Local Network Gateway in Azure using FQDN. Doing so in the portal leads to an error.
New-AzLocalNetworkGateway -Name AzureToFritzBoxVPN-LNG -ResourceGroupName AzureToFritzBoxVPN-RG -Location "West Europe" -fqdn "argq6adasd23ruo.myfritz.net" -AddressPrefix "10.1.1.0/24"
@norman-bauer
norman-bauer / Install-VMM2022UR1.ps1
Created March 20, 2023 10:58
Stops VMM Services, installs UR1 update and checks file version.
Stop-Service SCVMMService
Stop-Service SCVMMAgent
C:\temp\kb5019202_vmmserver_amd64.msp
C:\temp\kb5019203_AdminConsole_amd64.msp
(Get-Item "C:\Program Files\Microsoft System Center\Virtual Machine Manager\bin\vmmservice.exe").VersionInfo
@norman-bauer
norman-bauer / Raise-FsrmReportLimits.ps1
Last active January 11, 2023 09:35
This script helps raising certain File Server Resource Manager Report limits.
$fsrm = New-Object -ComObject "Fsrm.FsrmReportManager"
enum FsrmReportLimit {
MaxFiles = 1
MaxFileGroups = 2
MaxOwners = 3
MaxFilesPerFileGroup = 4
MaxFilesPerOwner = 5
MaxFilesPerDuplGroup = 6
MaxDuplicateGroups = 7
@norman-bauer
norman-bauer / Convert-CertificateToPEM
Created April 11, 2022 11:20
Converts certificate installed in machine store to pem file
Install-Module -Name PSPKI
Import-Module -Name PSPKI
$cert = @(Get-ChildItem cert:\LocalMachine\My | Where-Object {$_.Subject -like "*CertificateSubject*"})[0]
Convert-PfxToPem -Certificate $cert -OutputFile "c:\temp\output.pem"
@norman-bauer
norman-bauer / Unarchive-Certificate.ps1
Last active January 10, 2022 08:47
PowerShell script to unarchive a previously archived certificate in the local machine my store
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "My","LocalMachine"
$store.Open(9) #ReadWrite + IncludeArchived
$store.Certificates |? Archived -eq $true
$store.Certificates |? Archived -eq $true |% {$_.Archived = $false} #Unarchive all certificates
$store.Certificates |? Subject -eq "CN=archivedcert" |% {$_.Archived = $false} #Unarchive certificates with given subject
$store.Close()
@norman-bauer
norman-bauer / Remove-AllMediaFromScVirtualMachinesV2.ps1
Created December 3, 2021 10:14
This small snippet removes mounted media from all SCVMM VMs. This will also *get* drives of snapshots, which cannot be processed.
Get-SCVirtualDVDDrive -All | Where-Object {$_.Connection -ne 'None' -and $_.Connection -ne $null} | Set-SCVirtualDVDDrive -NoMedia
@norman-bauer
norman-bauer / GermanTimezone.cmd
Created August 26, 2021 09:48
Changes Windows timezone to Western Europe Standard Time with DST.
tzutil /s "W. Europe Standard Time"
@norman-bauer
norman-bauer / Remove-AllMediaFromScVirtualMachines.ps1
Created July 17, 2021 08:19
This small snippet removes mounted media from all SCVMM VMs.
Get-SCVirtualMachine | Foreach-Object {
$vm = $_;
$dvd = Get-SCVirtualDVDDrive -VM $vm;
if ($dvd.Connection -ne 'None' -and $dvd.Connection -ne $null) {
Set-SCVirtualDVDDrive -VirtualDVDDrive $dvd -NoMedia
}
}