Skip to content

Instantly share code, notes, and snippets.

Joerg Hochwald jhochwald

Block or report user

Report or block jhochwald

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jhochwald
jhochwald / Invoke-CheckPowerShellModules.ps1
Created May 24, 2019
Check if one or more given modules are installed. Any missing modules can be installed (optional) and updated to the latest version available on the PowerShell Gallery can be applied (optional).
View Invoke-CheckPowerShellModules.ps1
#requires -Version 3.0 -Modules PowerShellGet
function Invoke-CheckPowerShellModules
{
<#
.SYNOPSIS
Check if one or more given modules are installed.
.DESCRIPTION
Check if one or more given modules are installed.
@jhochwald
jhochwald / Get-DirectorySize.ps1
Created May 8, 2019
Get the size of a given folder in a human readable format
View Get-DirectorySize.ps1
function Get-DirectorySize
{
<#
.SYNOPSIS
Get the size of a given folder in a human readable format
.DESCRIPTION
Get the size of a given folder in a human readable format
.PARAMETER Path
@jhochwald
jhochwald / Test-IsAdmin.ps1
Created May 8, 2019
Check if PowerShell run elevated (e.g. as admin or not)
View Test-IsAdmin.ps1
function Test-IsAdmin
{
<#
.SYNOPSIS
Check if PowerShell run elevated (e.g. as admin or not)
.DESCRIPTION
This is a complete new approach to check if the Shell runs elevated or not.
It runs on PowerShell and PowerShell Core, and it supports macOS or Linux as well.
@jhochwald
jhochwald / Check-StorSvc.ps1
Created May 7, 2019
Check the Storage Service (StorSvc) and/or set it to the right Startup Type
View Check-StorSvc.ps1
# Get the Startup Type for the Storage Service
Get-Service -Name StorSvc | Select-Object -ExpandProperty StartType
# Check of the Storage Service is set to Manual Startup (Manual seems to be fine)
Get-Service -Name StorSvc | Where-Object { $_.StartType -cne 'Manual' }
# Set the Startup Type to Manual if it is not the case
Get-Service -Name StorSvc | Where-Object { $_.StartType -cne 'Manual' } | Set-Service -StartupType Manual
@jhochwald
jhochwald / Convert-JSON2YAML_and_YAML2JSON.ps1
Created May 5, 2019
PowerShell: Covert YAML to JSON and JSON to YAML
View Convert-JSON2YAML_and_YAML2JSON.ps1
# Create a YAML Document (Source https://yaml.org/start.html)
$RawYaml = @'
---
invoice: 34843
date : 2001-01-23
bill-to: &id001
given : Chris
family : Dumars
address:
lines: |
@jhochwald
jhochwald / Update-UnifiedGroupsToTeams.ps1
Created Apr 21, 2019
Converts all Microsoft Office 365 Groups into a new Microsoft Teams Team
View Update-UnifiedGroupsToTeams.ps1
#requires -Version 3.0 -Modules MicrosoftTeams
function Update-UnifiedGroupsToTeams
{
<#
.SYNOPSIS
Converts all Microsoft Office 365 Groups into a new Microsoft Teams Team
.DESCRIPTION
Converts all Microsoft Office 365 Groups into a new Microsoft Teams Team
Microsoft Office 365 Groups are also known as Unified Office 365 Groups
@jhochwald
jhochwald / Copy-ADGroupUserMemberships.ps1
Created Mar 23, 2019
Copy the membership of a given group to another group in Active Directory
View Copy-ADGroupUserMemberships.ps1
#requires -Version 3.0 -Modules ActiveDirectory
function Copy-ADGroupUserMemberships
{
<#
.SYNOPSIS
Copy the membership of a given group to another group in Active Directory
.DESCRIPTION
Copy the membership of a given group to another group in Active Directory.
@jhochwald
jhochwald / Copy-ADUserGroupMemberships.ps1
Created Mar 23, 2019
Copy group memberships from a given Source-User to a Target-User in Active Directory
View Copy-ADUserGroupMemberships.ps1
#requires -Version 3.0 -Modules ActiveDirectory
function Copy-ADUserGroupMemberships
{
<#
.SYNOPSIS
Copy group memberships from a given Source-User to a Target-User in Active Directory
.DESCRIPTION
Copy group memberships from a given Source-User to a Target-User in Active Directory.
@jhochwald
jhochwald / iperf3_mini_workshop.md
Last active Jan 31, 2019
iperf3 a TCP, UDP, and SCTP network bandwidth measurement tool (From a mini workshop)
View iperf3_mini_workshop.md

iperf3 a TCP, UDP, and SCTP network bandwidth measurement tool

iperf is a free tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, protocols, and buffers.

For each test it reports the measured throughput / bitrate, loss, and other parameters.

Command line arguments

The following arguments are the one that we used in the workshop. All will work in iperf3 version 3.1, or newer. All of them will work on Windows, Linux, and macOS. There are a few others, that might be plattform specific.

@jhochwald
jhochwald / UnixTimeStampTools.ps1
Last active Jan 18, 2019
Converts a Timestamp (Epochdate) into Datetime AND Converts a Datetime into a Unix Timestamp (Epochdate)
View UnixTimeStampTools.ps1
function ConvertFrom-UnixTimeStamp
{
<#
.SYNOPSIS
Converts a Timestamp (Epochdate) into Datetime
.DESCRIPTION
Converts a Timestamp (Epochdate) into Datetime
.PARAMETER TimeStamp
You can’t perform that action at this time.