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 / Copy-ADUserGroupMembershipSimple.ps1
Last active Jul 9, 2019
Copy group memberships from a given Source User to a Target User(s) in Active Directory - Simple Version of Copy-ADUserGroupMemberships
View Copy-ADUserGroupMembershipSimple.ps1
function Copy-ADUserGroupMembershipSimple
{
<#
.SYNOPSIS
Copy group memberships from a given Source User to a Target User(s) in Active Directory
.DESCRIPTION
Copy group memberships from a given Source User to a Target User(s) in Active Directory.
Simple Version of Copy-ADUserGroupMemberships
@jhochwald
jhochwald / CleanupExchangeLogs.ps1
Last active Jul 8, 2019
Cleanup some Exchange Sevrer logs.
View CleanupExchangeLogs.ps1
#requires -Version 2.0
<#
.SYNOPSIS
Exchange Server Logs Cleanup
.DESCRIPTION
Cleanup some Exchange Sevrer logs.
.EXAMPLE
@jhochwald
jhochwald / Invoke-AdvancedInstallerUpdate.ps1
Created Jul 3, 2019
Sample function to rebuild a given Advanced Installer Project - I use it within my build process for some modules and tools
View Invoke-AdvancedInstallerUpdate.ps1
#requires -Version 3.0
function Invoke-AdvancedInstallerUpdate
{
<#
.SYNOPSIS
Sample Script to rebuild a given Advanced Installer Project
.DESCRIPTION
Rebuild a given Advanced Installer Project.
@jhochwald
jhochwald / unifi_controller_update.sh
Created Jun 8, 2019
Download a new UniFi Controller Firmware and install it. Used to to automate the installation of newer controller firmware on a UniFi Cloud Key
View unifi_controller_update.sh
#!/usr/bin/env bash
# Download a new UniFi Controller Firmware and install it
# Used to to automate the installation of newer controller firmware on a UniFi Cloud Key
# Author: Joerg Hochwald
# Copyright: Copyright (c) 2019, Joerg Hochwald - All rights reserved.
# LICENSE: License: https://opensource.org/licenses/BSD-3-Clause
# THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
@jhochwald
jhochwald / unifi_controller_update.sh
Created Jun 8, 2019
Download a new UniFi Controller Firmware and install it. Used to to automate the installation of newer controller firmware on a UniFi Cloud Key
View unifi_controller_update.sh
#!/usr/bin/env bash
# Download a new UniFi Controller Firmware and install it
# Used to to automate the installation of newer controller firmware on a UniFi Cloud Key
# Author: Joerg Hochwald
# Copyright: Copyright (c) 2019, Joerg Hochwald - All rights reserved.
# LICENSE: License: https://opensource.org/licenses/BSD-3-Clause
# THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
@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: |
You can’t perform that action at this time.