Skip to content

Instantly share code, notes, and snippets.

Mark Lenhardt weipah

Block or report user

Report or block weipah

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
weipah / deviceportal-fix.ps1
Last active Jun 19, 2017
Enable https support for Windows IoT Device Portal Website
View deviceportal-fix.ps1
# Fix ownership
# Is it correct that it changes ownership only for subfolder "service"?
# Why "machine" and not "HKEY_LOCAL_MACHINE?
.\TakeRegistryOwnership.exe MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\webmanagement\service
# Add registry keys
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\webmanagement\service /v EncryptionMode /t REG_DWORD /d 0x3 /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\webmanagement\service /v HttpsPort /t REG_DWORD /d 4443 /f
# add corresponding firewall rules
weipah / enable-split-tunneling.ps1
Created Apr 6, 2016
Enable split-tunneling for a VPN connection on Windows 10
View enable-split-tunneling.ps1
# List all VPN connections
# Enable split-tunneling for a specific connection
Set-VPNConnection -name "<see list>" -SplitTunneling $true
weipah / MassMailerHTML.ps1
Created Mar 19, 2015
MassMailerHTML - Inform users from ActiveDirectory per Mail with Send-Mailmessage Cmdlet
View MassMailerHTML.ps1
# Script to inform multiple users via Mail
# Two datasources
# 1. Old Firewall VPN Config -> Exported as XML
# 2. Active Directory Accounts
$date = (get-date)
# Which file should be send with the mail as an attachment?
$attachment = "C:\Users\xyz\Documents\beispiel-anhang.txt"
weipah / import-portatour.ps1
Last active Jun 12, 2019
PowerShell V3 Multipart/formdata example with REST-API (Invoke-RestMethod)
View import-portatour.ps1
function Import-Portatour {
param (
[parameter(Mandatory=$True,Position=1)] [ValidateScript({ Test-Path -PathType Leaf $_ })] [String] $FilePath,
[parameter(Mandatory=$False,Position=2)] [System.URI] $ResultURL
$CODEPAGE = "iso-8859-1" # alternatives are ASCII, UTF-8
# We have a REST-Endpoint
weipah / findUserOnTerminalServer.ps1
Created Nov 29, 2012
Poll a list of Windows Terminal Servers for a specific User (Multithreading attempt 2)
View findUserOnTerminalServer.ps1
#require -version 2.0
# based on source from:
# does not really work, because the waithandle is not processed correctly
# using $wait[$i].WaitOne() in for-loop would work, but is not the right way to process jobs in parallel
# create a pool of 10 runspaces
$pool = [runspacefactory]::CreateRunspacePool(1,10)
weipah / pollTerminalServers.ps1
Created Nov 26, 2012
Poll a list of Windows Terminal Servers for a specific User (Multithreading attempt 1)
View pollTerminalServers.ps1
function Get-XTSSession() {
Param ([Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, HelpMessage="UserName?")]
$User )
$aco_servers = "C:\Users\adm-ml\Documents\WindowsPowerShell\Modules\PSTerminalServices\aco-terminal-servers.txt"
$workingDirectory = (get-location)
if ($user.gettype().fullname -eq "System.String") {
if ($user -ne $null -and $user.length -gt 0) {
$username = $user
weipah / repeating-table-auto-increment.cs
Created Sep 6, 2012
Auto-increment repeating table position in InfoPath
View repeating-table-auto-increment.cs
// "my:Inhalte" --> Repeating table data
public void Projektinformationen_Changed(object sender, XmlEventArgs e)
//e.Operation property is equal to XmlOperation.Insert or XmlOperation.Delete
XPathNavigator nav = MainDataSource.CreateNavigator();
XPathNodeIterator iter = nav.Select("/my:meineFelder/my:Inhalte/my:Position", NamespaceManager);
int i = 1;
weipah / getPathFromEMail.vb
Created Jul 27, 2012
Get full path from email in Outlook 2010
View getPathFromEMail.vb
Sub Pfad_anzeigen()
Dim ordner As Outlook.MAPIFolder
Dim ordnerPfad As String
Set ordner = Application.ActiveExplorer.Selection.Item(1).parent
ordnerPfad = ordner.Name
Do Until ordner.parent = "Mapi"
Set ordner = ordner.parent
weipah / PasswordExpireDate.ps1
Created Apr 27, 2012
Find out when a user password will expire or if already expired
View PasswordExpireDate.ps1
function Get-XADUserPasswordExpirationDate() {
Param ([Parameter(Mandatory=$false, Position=0, ValueFromPipeline=$true, HelpMessage="Identity of the Account")]
[Object] $accountIdentity )
If ($accountIdentity -eq $null) {
$computer = Get-WmiObject win32_computerSystem -ComputerName "."
$user = $computer.UserName.Split("\")
$accountIdentity = $user[$user.length-1]
weipah / XADGroupCopy.ps1
Created Apr 27, 2012
Copy ActiveDirectory-Groups from one user to another
View XADGroupCopy.ps1
function XADGroupCopy() {
[parameter(Mandatory=$true,Position=0,HelpMessage="Von welchem User sollen Berechtigungen kopiert werden?")]
[parameter(Mandatory=$true,Position=1,HelpMessage="Welcher User erhaelt die neuen Gruppen?")]
You can’t perform that action at this time.